久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

檢查 UIScrollView 是否到達頂部或底部

Check if a UIScrollView reached the top or bottom(檢查 UIScrollView 是否到達頂部或底部)
本文介紹了檢查 UIScrollView 是否到達頂部或底部的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

有沒有辦法知道 UIScrollView 是到達頂部還是底部?可能在方法中:

Is there a way to know if a UIScrollView has reached the top or bottom? Possibly in the method:

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView 
                  willDecelerate:(BOOL)decelerate

推薦答案

在你的類中實現(xiàn)UIScrollViewDelegate,然后添加:

Implement the UIScrollViewDelegate in your class, and then add this:

-(void)scrollViewDidScroll: (UIScrollView*)scrollView
{
    float scrollViewHeight = scrollView.frame.size.height;
    float scrollContentSizeHeight = scrollView.contentSize.height;
    float scrollOffset = scrollView.contentOffset.y;

    if (scrollOffset == 0)
    {
        // then we are at the top
    }
    else if (scrollOffset + scrollViewHeight == scrollContentSizeHeight)
    {
        // then we are at the end
    }
}

希望這就是你所追求的!否則,通過在上面的代碼中添加更多條件和 NSLog 滾動偏移的值來進行修補.

Hope this is what you are after! Else have a tinker by adding more conditions to the above code and NSLog the value of scrollOffset.

這篇關(guān)于檢查 UIScrollView 是否到達頂部或底部的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to subclass UIScrollView and make the delegate property private(如何繼承 UIScrollView 并使委托屬性私有)
Swift - how to get last taken 3 photos from photo library?(Swift - 如何從照片庫中獲取最后拍攝的 3 張照片?)
Setting contentOffset programmatically triggers scrollViewDidScroll(以編程方式設(shè)置 contentOffset 觸發(fā) scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁面之間的照片應(yīng)用程序式間隙)
why UIScrollView is leaving space from top in ios 6 and ios 7(為什么 UIScrollView 在 ios 6 和 ios 7 中從頂部留下空間)
UIScrollView pauses NSTimer while scrolling(UIScrollView 在滾動時暫停 NSTimer)
主站蜘蛛池模板: 亚洲精品乱码8久久久久久日本 | 国产欧美一区二区精品久导航 | 精品国产伦一区二区三区观看方式 | 亚洲精选久久 | 日韩高清中文字幕 | 日韩精品a在线观看图片 | 性大毛片视频 | 久久久片 | 国产精品美女久久久久久免费 | 在线视频 中文字幕 | 午夜99 | 在线视频99| 国产黄色一级片 | 日本成人在线网址 | 国产日韩欧美在线播放 | 亚洲精品一区二区在线观看 | 国产丝袜一区二区三区免费视频 | 色婷婷久久综合 | 国产成人精品综合 | 91久久夜色精品国产网站 | 日韩精品免费视频 | 黄色在线免费看 | 日韩a | 亚洲女优在线播放 | 精品三区 | 亚洲 中文 欧美 日韩 在线观看 | 偷拍自拍网站 | 在线一区视频 | 国产精品视频一区二区三区 | 超碰在线97国产 | 91国内视频在线 | 亚洲一视频| 成人99 | 欧美日韩亚洲一区 | 久久免费电影 | 成人网av | 国产乱码精品一区二三赶尸艳谈 | 成人一级片在线观看 | 亚洲高清成人在线 | 欧美一区成人 | 一片毛片|