我有一组PDF,有些是一页,有些是两页。我希望看到PDF的下一个可见屏幕高度值,或者如果PDF的剩余高度小于webView的高度,则滚动到PDF的底部。到目前为止,我只能将webView滚动到底部。这是我的功能...我错过了什么?
func scrollDown() {
let scrollView = webview.scrollView
let contentSize = scrollView.contentSize
let contentOffset = scrollView.contentOffset
let frameSize = webview.frame.size
if scrollView.contentOffset.y <= 0 {
// Scroll one view's height at a time
// If the contentSize - offset.y is greater than the frame's height
if (contentSize.height - contentOffset.y) > frameSize.height {
scrollView.setContentOffset(CGPoint(x: 0, y: contentOffset.y + (contentSize.height - frameSize.height)), animated: true)
} else {
scrollView.setContentOffset(CGPoint(x: 0, y: 0), animated: true)
}
}
}
答案 0 :(得分:0)
如果有其他人需要这个。吸取的教训是在纸上绘制,以了解正在发生的事情......
WITH yourTable AS (
SELECT 'M' AS Sex, 'US' AS Country, 40000 AS Income, 'Acme' AS Company UNION ALL
SELECT 'M', 'CA', 50000, 'Bravo' UNION ALL
SELECT 'F', 'US', 30000, 'Bravo' UNION ALL
SELECT 'F', 'FR', 40000, 'Acme' UNION ALL
SELECT 'M', 'FR', 40000, 'Delta'
)