UIScrollView 滚动停止的时候一次调用此方法

//拖动返回选中的索引 当滚动视图停止时的时候
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    CGFloat width = scrollView.frame.size.width;
    NSLog(@"%f",scrollView.contentOffset.x);
    int page = (scrollView.contentOffset.x + (0.5f * width)) / width;
    
    if(_delegate && [_delegate respondsToSelector:@selector(currentTabHasChanged:)] )
    {
        [_delegate currentTabHasChanged:page];
    }
}

  

posted @ 2015-09-09 15:10  Athook  阅读(738)  评论(0编辑  收藏  举报