-
-
Save alexszilagyi/4871d007afc36ef99d9566fc31479f5f to your computer and use it in GitHub Desktop.
shouldStartLoadWithRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool { | |
let url = request.URL | |
if navigationType == .Other { | |
if url?.scheme == "ready" { | |
print(arrowBottomButton.frame.origin.y) | |
webViewHeight.constant = (url?.host?.floatValue)! + 20 | |
var totalSize = self.getTotalSize() | |
totalSize.height = totalSize.height + webViewHeight.constant | |
self.scrollView.contentSize = totalSize | |
return false | |
} | |
} | |
return true | |
} | |
func getTotalSize() -> CGSize { | |
var contentRect: CGRect = CGRect.zero | |
for view in self.scrollView.subviews { | |
contentRect = CGRectUnion(contentRect, view.frame) | |
} | |
return contentRect.size | |
} |
Author
alexszilagyi
commented
Apr 10, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment