Thứ Sáu, 24 tháng 7, 2015

Swift : working with UIWebView

Q: Need check the UIWebView is scrolled to end
http://stackoverflow.com/a/10961734
code:
var contentHeight = scrollView.contentSize.height
var height = scrollView.frame.size.height
var offset = scrollView.contentOffset.y

if(offset == 0) {
    webViewScrolledToTop = true;
    webViewScrolledToBottom = false;
} else if(height + offset == contentHeight) {
    webViewScrolledToTop = false;
    webViewScrolledToBottom = true;
} else {
    webViewScrolledToTop = false;
    webViewScrolledToBottom = false;
}

Continue ...


- Comments

0 nhận xét:

Đăng nhận xét