import WebKit final class LimitedWKWebView: WKWebView { // storyboard required init?(coder: NSCoder) { super.init(coder: coder) // 選択をさせない navigationDelegate = self self.scrollView.delegate = self // 平行のインジケーター出さない self.scrollView.showsHorizontalScrollIndicator = false } override func target( forAction action: Selector, withSender sender: Any? ) -> Any? { return nil } override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { return false } } extension LimitedWKWebView: WKNavigationDelegate { // https://stackoverflow.com/questions/48467723/how-to-disable-user-selection-in-a-wkwebview-in-swift func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { let javascriptStyle = "var css = '*{-webkit-touch-callout:none;-webkit-user-select:none}'; var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = 'text/css'; style.appendChild(document.createTextNode(css)); head.appendChild(style);" webView.evaluateJavaScript(javascriptStyle, completionHandler: nil) } } extension LimitedWKWebView: UIScrollViewDelegate { // Zoomいらない func scrollViewWillBeginZooming(_ scrollView: UIScrollView, with view: UIView?) { scrollView.pinchGestureRecognizer?.isEnabled = false } // 横スクロールいらない func scrollViewDidScroll(_ scrollView: UIScrollView) { if (scrollView.contentOffset.x > 0){ scrollView.contentOffset = CGPoint(x: 0, y: scrollView.contentOffset.y) } } }
10万円は1000円くらい利益
資産運用ブログ アセマネ
-
・寄付お願いします
YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo