我已经调用了Web服务,并且没有从数据到两个数据的数据。我已经滚动了集合视图来加载我已经将数据传递给两个数据的更多数据。我一直在使用滚动视图,管理使用此分页的委托方法。
答案 0 :(得分:1)
设置UIScrollView协议 - UIScrollViewDelegate
并定义以下方法。
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
}
more details in this method :(基于www.developer.apple.com)
告诉代表滚动视图已经结束减速滚动动作。
宣言(目标-c:)
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
参数
scrollView:滚动视图对象,它正在减慢内容视图的滚动。
讨论
滚动视图在滚动动作停止时调用此方法。 UIScrollView的减速属性控制减速。
状况:
适用于iOS 2.0及更高版本。
使用此代码:
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
float endScrolling = (scrollView.contentOffset.y + scrollView.frame.size.height);
if (endScrolling >= scrollView.contentSize.height)
{
//Manage Pagination
from_Post = from_Data + Page_Number; //Like 10, 20 as you define
to_Post = to_Data + Page_Number; //Like 10, 20 as you define
//Called Function for You Performing action
[self GetDataFrom:from_Post To:to_Post];
}
}
答案 1 :(得分:0)
将集合视图的委托设置为self,并实现UIScrollDelegate的方法,如下所示:
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
//Get the page
NSInteger page = scrollView.contentOffset.x / scrollView.bounds.size.width;
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (!decelerate) {
//Get the page
NSInteger page = scrollView.contentOffset.x / scrollView.bounds.size.width;
}
}
答案 2 :(得分:0)
对于Swift
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let endScrolling = (scrollView.contentOffset.y + scrollView.frame.size.height)
if endScrolling >= scrollView.contentSize.height {
//Manage Pagination
//from_Post = from_Data + Page_Number; //Like 10, 20 as you define
//to_Post = to_Data + Page_Number; //Like 10, 20 as you define
//Called Function for You Performing action
//[self GetDataFrom:from_Post To:to_Post];
}
}