久久久久久久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)建圖像)
主站蜘蛛池模板: 九九热最新地址 | 免费一区二区三区 | 一区二区三区四区毛片 | 欧美性大战久久久久久久蜜臀 | 免费高潮视频95在线观看网站 | 欧美一a一片一级一片 | 麻豆av在线免费观看 | 韩日av在线 | 国产不卡视频 | 作爱视频免费看 | 一区二区三区免费 | 久久久视频在线 | 狠狠躁躁夜夜躁波多野结依 | 欧美一级做性受免费大片免费 | 中文字幕日韩欧美一区二区三区 | 偷牌自拍 | 亚洲国产欧美国产综合一区 | 久久精品亚洲一区 | 久久久久久一区 | 亚洲激情网站 | 久久久久久久久久久久久9999 | 91丨九色丨国产在线 | 国产精品亚洲一区二区三区在线 | 日本在线一区二区 | 亚洲综合色自拍一区 | 欧美一级小视频 | 日本成人久久 | 7777久久| 亚洲一区二区在线播放 | 国产精品免费一区二区三区 | 精品欧美一区二区精品久久久 | 激情五月婷婷 | 欧美视频免费在线 | 国产成人精品高清久久 | 国产日韩欧美91 | 久久久久久99 | 欧美成人视屏 | av手机在线| 成年人免费网站 | 久久精品国产一区 | 久久人人网 |