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

帶有“圓形"的 UIScrollView滾動

UIScrollView with quot;Circularquot; scrolling(帶有“圓形的 UIScrollView滾動)
本文介紹了帶有“圓形"的 UIScrollView滾動的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試在我的 UIScrollView 中進行循環"滾動,但沒有成功.

I am trying to make "Circular" scrolling in my UIScrollView, but unsuccessful.

我想做什么:如果 uiscrollview 到達結束,它應該移動開始如果 uiscrollview 在開始并向后移動,它應該移動到結束

What I want to do: if uiscrollview reaches end, it should move to start if uiscrollview at start and moving back, it should move to end

在我的情況下附加滾動視圖不是好方法(其他方法應該得到頁面ID")

Appending scrollview isn't good way in my situation (other methods should get "page id")

你有什么想法嗎?

推薦答案

我已經實現了這個方法,但是它需要啟用分頁.假設您有五個元素 A、B、C、D 和 E.設置視圖時,將最后一個元素添加到開頭,將第一個元素添加到結尾,并調整內容偏移量以查看第一個元素,例如 E,[A],B,C,D,E,A.在 UIScrollViewDelegate 中,檢查用戶是否到達任何一端,并將偏移 without 動畫移動到另一端.

I've implemented this method, but it requires paging enabled. Lets assume you have five elements A,B,C,D and E. When you set up your view, you add the last element to the beginning and the first element to the end, and adjust the content offset to view the first element, like this E,[A],B,C,D,E,A. In the UIScrollViewDelegate, check if the user reach any of the ends, and move the offset without animation to the other end.

想象一下 [ ] 表示正在顯示的視圖:

Imagine the [ ] indicates the view being shown:

E,A,B,C,[D],E,A

用戶向右滑動

E,A,B,C,D,[E],A

用戶向右滑動

E,A,B,C,D,E,[A]

然后,自動設置內容偏移到第二個元素

Then, automatically set the content offset to the second element

E,[A],B,C,D,E,A

通過這種方式,用戶可以雙向滑動創建無限滾動的錯覺.

This way the user can swipe both ways creating the illusion of an infinite scroll.

E,A,[B],C,D,E,A


更新

我已經上傳了該算法的完整實現.這是一個非常復雜的類,因為它還具有點擊選擇、無限循環滾動和單元格重用.您可以按原樣使用代碼,修改它或提取您需要的代碼.最有趣的代碼在 TCHorizo??ntalSelectorView 類中.


Update

I've uploaded a complete implementation of this algorithm. It's a very complicated class, because it also has on-click selection, infinite circular scroll and cell reuse. You can use the code as is, modify it or extract the code that you need. The most interesting code is in the class TCHorizontalSelectorView.

文件鏈接

盡情享受吧!

UICollectionView 現在是實現此目的的推薦方法,它可用于獲得完全相同的行為.本教程詳細描述了如何去實現它.

UICollectionView is now the recommended way to achieve this and it can be used to obtain the very same behavior. This tutorial describes in details how to achieve it.

這篇關于帶有“圓形"的 UIScrollView滾動的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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(以編程方式設置 contentOffset 觸發 scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁面之間的照片應用程序式間隙)
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)
主站蜘蛛池模板: 毛片一级黄色 | 亚洲国产精品一区二区三区 | 国产精品无码久久久久 | 午夜爽爽男女免费观看hd | 可以免费观看的av片 | 国产精品久久国产精品 | 91资源在线 | 亚洲人在线 | 亚洲高清av | 欧美 日韩 国产 成人 在线 | aa级毛片毛片免费观看久 | 91在线色视频 | 国产一二区视频 | 国内精品视频免费观看 | 99在线免费观看视频 | 91精品久久久 | 综合久久综合久久 | 亚洲精品二三区 | 国产精品二区三区 | 午夜小影院 | 91精品国产麻豆 | 亚洲欧美日韩精品久久亚洲区 | 一区二区三区四区电影视频在线观看 | 天天射影院 | 国产一区久久精品 | 成人a网 | 欧美福利久久 | av影音资源| 在线成人www免费观看视频 | 成人精品在线视频 | 免费看91| 爱爱无遮挡 | 亚洲国产精品99久久久久久久久 | 久久亚洲一区 | 黄色片免费 | 久久这里只有精品首页 | 亚洲一区二区三区视频 | 亚洲第一av | 一级片免费视频 | 一级免费毛片 | 国产一区二区三区四区五区加勒比 |