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

如何實現一個循環(huán)的 UIScrollView?

How to implement a cyclic UIScrollView?(如何實現一個循環(huán)的 UIScrollView?)
本文介紹了如何實現一個循環(huán)的 UIScrollView?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

如何實現一個循環(huán)的UIScrollView?也就是說,當您滾動到最左邊的項目時,UIScrollView 將顯示最右邊的項目.任何幫助將不勝感激.

How to implement a cyclic UIScrollView? That is to say, when you scroll to the very left item then the UIScrollView will show the very right one. Any help would be appreciate.

推薦答案

當然,你需要三個視圖.在任何給定時間,您都有左視圖、右視圖和當前視圖.

Sure, you need three views. At any given time you have a left view, a right view and a current view.

這需要通過 UIScrollViewDelegate 通知每次移動.

This requires notification of each movement through the UIScrollViewDelegate.

如果您檢測到您向右移動,則釋放左側,使左側 = 當前,當前 = 右側,然后進行新的右側操作.

If you detect that you moved right, you free left, make left = current, current = right, and make a new right.

如果您檢測到您向左移動,則釋放右側,使右側 = 當前,當前 = 左側,然后形成新的左側.

If you detect that you moved left, you free right, make right = current, current = left, and make a new left.

一般來說,任何與當前頁面相差一頁以上的視圖都是不需要的.所以你總共只需要三頁.

Generally speaking, any view that is more than one page away from current is not required. So you need only three pages in total.

當然,您還需要操縱 UIScrollView 的位置,以便進行移動 - 最終結果是您沒有移動,盡管看起來您已經移動了.當您完成滾動并根據左/當前/右隨機播放更改視圖時 - 您可以

Of course you also need to manipulate the position of the UIScrollView so you can make the movements - the net result is you don't move although it looks like you have. When you have done the scroll, and altered the views according to the left/current/right shuffle - you do

  [self scrollRectToVisible:(middle frame) animated:NO];

這樣您就可以始終查看同一個實際頁面,每側各有一個頁面.當滾動發(fā)生時,看起來用戶可以繼續(xù)循環(huán)滾動 - 但是在每個頁面結束后,視圖會被打亂,滾動視圖中的位置會被設置回中間,并且用戶可以再次滾動.

so that you are always looking at the same actual page, with one page each side of it. When the scroll happens it looks like the user can keep scrolling around in a loop - but after each page ticks over, the views are shuffled, the position within the scroll view gets set back to the middle and the user can scroll again.

回到開始只是使用與您正在使用的任何數據結構的另一端的任何對象相關的視圖 - 所以如果 current = [(NSArray)data lastObject] 然后 right = [(NSArray)data objectAtIndex:0].

Getting back to the start is simply a matter of using the view related to whatever object is at the other end of whatever data structure you are using - so if current = [(NSArray)data lastObject] then right = [(NSArray)data objectAtIndex:0].

這篇關于如何實現一個循環(huán)的 UIScrollView?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

iOS - Using storyboard and autolayout to center the UIScrollView(iOS - 使用故事板和自動布局使 UIScrollView 居中)
get index or tag value from imageview tap gesture(從 imageview 點擊手勢獲取索引或標簽值)
UIScrollView not scrolling regardless of large contentSize(無論內容大小如何,UIScrollView 都不會滾動)
Clean autorotation transitions in a paging UIScrollView(清除分頁 UIScrollView 中的自動旋轉轉換)
UIScrollView zooming with Auto Layout(UIScrollView 使用自動布局縮放)
How to create an image from a UIView / UIScrollView(如何從 UIView/UIScrollView 創(chuàng)建圖像)
主站蜘蛛池模板: 特黄色毛片 | 精品欧美一区二区精品久久久 | 午夜视频在线免费观看 | 成人精品视频在线观看 | 久久伊人精品 | av片在线免费看 | 亚洲精品视频免费观看 | 久久久久网站 | 波多野结衣一区二区 | 国产a级毛片 | 成人免费视频网站在线看 | 亚洲欧美一区二区三区国产精品 | 亚洲少妇综合网 | 免费黄篇| 成人av一区二区三区 | 欧美淫 | 日韩在线视频一区二区三区 | 日韩精品一区二区三区中文字幕 | 国产精品久久视频 | 亚洲网站免费看 | 久久综合国产精品 | 性色的免费视频 | 免费观看黄网站 | 91精品亚洲 | 免费特级黄毛片 | 二区三区av | 欧美中文在线 | 国产一区二区在线免费观看 | 亚洲国产成人精品女人久久久 | 日日操夜夜操天天操 | 精品久久久久久亚洲综合网站 | 国产网站在线免费观看 | 在线观看亚洲精品视频 | 欧美v免费 | 欧美色a v | 91精品国产乱码麻豆白嫩 | 天堂素人约啪 | 亚洲人成在线播放 | 日韩久久久久 | 黑人精品xxx一区一二区 | 欧美三级视频在线观看 |