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

帶有“圓形"的 UIScrollView滾動

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

問題描述

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

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

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

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")

你有什么想法嗎?

推薦答案

我已經(jīng)實現(xiàn)了這個方法,但是它需要啟用分頁.假設您有五個元素 A、B、C、D 和 E.設置視圖時,將最后一個元素添加到開頭,將第一個元素添加到結(jié)尾,并調(diào)整內(nèi)容偏移量以查看第一個元素,例如 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]

然后,自動設置內(nèi)容偏移到第二個元素

Then, automatically set the content offset to the second element

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

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

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

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


更新

我已經(jīng)上傳了該算法的完整實現(xiàn).這是一個非常復雜的類,因為它還具有點擊選擇、無限循環(huán)滾動和單元格重用.您可以按原樣使用代碼,修改它或提取您需要的代碼.最有趣的代碼在 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 現(xiàn)在是實現(xiàn)此目的的推薦方法,它可用于獲得完全相同的行為.本教程詳細描述了如何去實現(xiàn)它.

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.

這篇關(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(以編程方式設置 contentOffset 觸發(fā) 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)
主站蜘蛛池模板: 欧美一级大片 | 免费看国产片在线观看 | 欧美精品久久一区 | 国产九九av | 玖玖玖在线| 日本视频一区二区三区 | 欧美一级在线免费 | 韩日精品一区 | 午夜在线免费观看视频 | 国产精品伦一区二区三级视频 | 一起操网站 | 日本公妇乱淫xxxⅹ 国产在线不卡 | 国产专区视频 | 日韩欧美在线视频播放 | 伊人网一区 | 中文在线一区二区 | 久久久网 | 精品久久中文字幕 | 色狠狠一区 | 国产精品不卡 | 亚洲欧美一区二区三区在线 | 欧美一区精品 | 国产精品九九九 | 日韩在线精品 | 中文字幕一区二区三区在线观看 | 精品国产乱码久久久久久丨区2区 | 久久免费视频在线 | 国产精品久久久久不卡 | 成人免费视频网站在线看 | 日本免费一区二区三区视频 | 天天澡天天操 | 亚洲va欧美va人人爽午夜 | 在线一区二区三区 | 国产精品美女一区二区 | 日日噜 | 日韩av在线免费 | 国产线视频精品免费观看视频 | 99热在线免费 | 精品一区二区三区入口 | 色香蕉在线 | 亚洲不卡在线观看 |