2014年4月6日 星期日

ScrollView content attribution 捲到底才執行



所以我們可以在ScrollViewDelegate中降子判斷

#pragma --mark UIScrollViewDelegate
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    float bottomOffset = scrollView.contentSize.height - (scrollView.bounds.size.height -scrollView.contentInset.bottom);
    NSLog(@"bottom(%f) = scrollView.contentSize.height(%f) - (scrollView.bounds.size.height(%f) -scrollView.contentInset.bottom(%f))",bottomOffset,scrollView.contentSize.height, scrollView.bounds.size.height, scrollView.contentInset.bottom);
    //捲到底才執行
    if ( scrollView.contentOffset.y == bottomOffset )
    {
        //TODO:...
    }
}

沒有留言:

張貼留言