有什么事件可以通知supper view吗?
我尝试使用 scrollViewDidScroll。但它不会被调用。
-(void)scrollViewDidScroll: (UIScrollView*)scrollView
{
NSLog(@"At the bottom...");
}
最佳答案
必须先将webview中scrollview的delegate设置为self
。这样,当您滚动 webview 时,可以调用 scrollViewDidScroll:
。所以,试试这个:
- (void)viewDidLoad
{
[super viewDidLoad];
self.webview.scrollview.delegate = self;
}
- (void)scrollViewDidScroll:(UIScrollView*)scrollview
{
CGPoint offset = scrollView.contentOffset;
CGRect bounds = scrollView.bounds;
UIEdgeInsets inset = scrollView.contentInset;
CGFloat currentOffset = offset.y + bounds.size.height - inset.bottom;
if (currentOffset - scrollView.contentSize.height <= 0)
{
NSLog(@"At the bottom...");
}
}
关于iOS如何检查是否转到webView的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25521469/