答案 0 :(得分:2)
查看UIScrollviewDelegate方法:http://developer.apple.com/library/ios/#documentation/uikit/reference/uiscrollviewdelegate_protocol/Reference/UIScrollViewDelegate.html
您可能希望查看– scrollViewDidEndDragging:willDecelerate:
和– scrollViewDidEndDecelerating:
,然后在这些方法中使用scrollView.bounds
检查滚动视图的当前可见矩形,以确定用户是否已滚动到底部
答案 1 :(得分:0)
您可以查看以下代码。它可能对你有帮助。
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
scrollView.contentInset = UIEdgeInsetsMake(0.0, 0.0, 60.0, 0.0);
[scrollView scrollRectToVisible:CGRectMake(0, scrollView.contentSize.height, scrollView.frame.size.width, 160.0) animated:YES];
if ([scrollView viewWithTag:5000])
{
UIView *view = (UIView*)[scrollView viewWithTag:5000];
[view removeFromSuperview], view = nil;
}
UIView *viewloader = [[[UIView alloc] initWithFrame:CGRectMake(0.0, scrollView.contentSize.height, scrollView.contentSize.width, 160.0)] autorelease];
viewloader.tag = 5000;
UILabel *lblloader = [[[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, scrollView.frame.size.width-0.0, 60.0)] autorelease];
lblloader.backgroundColor = [UIColor clearColor];
lblloader.tag = 550;
lblloader.textColor = [UIColor whiteColor];
lblloader.textAlignment = NSTextAlignmentCenter;
lblloader.text = @"Click to load more data.";
[viewloader addSubview:lblloader];
viewloader.backgroundColor = [UIColor darkGrayColor];
UIButton *btnLoad = [UIButton buttonWithType:UIButtonTypeCustom];
btnLoad.frame = lblloader.frame;
btnLoad.backgroundColor = [UIColor clearColor];
[btnLoad addTarget:self action:@selector(callForMoreData:) forControlEvents:UIControlEventTouchUpInside];
[viewloader addSubview:btnLoad];
[scrollView addSubview:viewloader];
}