IOS 判斷scrollView是否滑動到底部

來源:互聯網
上載者:User

標籤:

判斷scrollView有沒有滾動到視圖的底部,用來做些什麼事情。也可以用來實現qq空間的社交動向更新哪個下拉之後,頂部圖片隨著展開的效果

- (void)scrollViewDidScroll:(UIScrollView *)scrollView1

{

    CGPoint offset = scrollView1.contentOffset;

    

    CGRect bounds = scrollView1.bounds;

    

    CGSize size = scrollView1.contentSize;

    

    UIEdgeInsets inset = scrollView1.contentInset;

    

    CGFloat currentOffset = offset.y + bounds.size.height - inset.bottom;

    

    CGFloat maximumOffset = size.height;

    

    //當currentOffset與maximumOffset的值相等時,說明scrollview已經滑到底部了。也可以根據這兩個值的差來讓他做點其他的什麼事情

    

    if(currentOffset==maximumOffset)

    {

        NSLog(@"-----我要重新整理資料-----");

    }

    

}

IOS 判斷scrollView是否滑動到底部

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.