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

清除分頁 UIScrollView 中的自動旋轉轉換

Clean autorotation transitions in a paging UIScrollView(清除分頁 UIScrollView 中的自動旋轉轉換)
本文介紹了清除分頁 UIScrollView 中的自動旋轉轉換的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個分頁 UIScrollView,用戶可以在其中水平瀏覽圖像,例如 Apple 的 Photos.app.這行得通,但現在我正在嘗試添加旋轉支持.

I have a paging UIScrollView in which the user pages horizontally through images, like Apple's Photos.app. That works, but now I'm trying to add rotation support.

我的視圖旋轉正常,并設法正確設置 contentSize、邊界和子視圖的框架以適應不同的方向.所以旋轉前后,一切正常.

I've got the view rotating OK and have managed to set the contentSize, bounds, and subviews' frames properly to adapt to the different orientations. So before and after the rotation, everything is OK.

但是,過渡本身很尷尬.第一個圖像完美旋轉,好像旋轉軸位于圖像的死點(滾動視圖框架).第二幅圖像擺動",因為旋轉軸在同一個位置:第一幅圖像的中心.我離第一張圖片越遠,擺動"越快.

However, the transitions themselves are awkward. The first image rotates perfectly, as if the axis of rotation is in the dead center of the image (scrollview frame). The second image "swings" in because the axis of rotation is in the same place: the center of the first image. The farther away I get from the first image, the faster the "swing."

我可以通過在旋轉之前覆蓋一個不透明的 UIView 并在之后隱藏它來掩蓋它.但這是一個黑客.必須有一種優雅的方式來做到這一點......

I can probably mask this by overlaying an opaque UIView before rotation and hiding it after. But that's a hack. There must be an elegant way to do this...

推薦答案

坦率地說,我不知道你在做什么,因為你根本沒有向我們展示太多.

Frankly, I don't know what you're doing, since you haven't shown us much at all.

但是!

我在滾動視圖中創建了一個包含幾個視圖的示例項目,它工作正常.隨意將其拆開.它通過創建 5 個視圖并將它們添加到滾動視圖來工作.然后在第一次設置這些視圖之后,每次應用程序旋轉時,它都會調用我的方法 alignSubviews 將它們布置在正確的頁面位置,并使它們與滾動視圖的大小相同, 同時更新滾動視圖的 contentSize.在旋轉發生之前,它會跟蹤滾動視圖當前所在的頁面,然后在旋轉期間將其重置為該頁面(因為頁面大小必須更改).

I created a sample project with a few views in a scroll view, and it works fine. Feel free to pick it apart as you wish. It works by creating 5 views, and adding them to the scroll view. Then after these views are set up for the first time, and every time the application rotates, it calls my method alignSubviews to lay them out at the right page locations and make them the same size as the scroll view, while updating the scroll view's contentSize. Before the rotation occurs, it keeps track of what page the scroll view is currently on, and then resets it to that page during the rotation (because the page size has to change).

下載Rotolling"!

這篇關于清除分頁 UIScrollView 中的自動旋轉轉換的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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 都不會滾動)
UIScrollView zooming with Auto Layout(UIScrollView 使用自動布局縮放)
How to create an image from a UIView / UIScrollView(如何從 UIView/UIScrollView 創建圖像)
iOS/Swift - Hide/Show UITabBarController when scrolling down/up(iOS/Swift - 向下/向上滾動時隱藏/顯示 UITabBarController)
主站蜘蛛池模板: 91九色麻豆 | www.日本在线 | 日日夜夜精品视频 | 国产伦精品一区二区三区照片91 | 精品中文字幕久久 | 日韩欧美国产一区二区 | 欧美久久一级 | www亚洲一区 | 国产精品亚洲片在线播放 | 欧美全黄 | 日韩毛片免费看 | 午夜在线小视频 | 久久久久91 | 日韩午夜影院 | 欧美日韩一区二区在线观看 | 日本不卡一区二区三区在线观看 | 亚洲欧美中文日韩在线v日本 | 成人性视频免费网站 | 狠狠操电影 | 紧缚调教一区二区三区视频 | 99久久99 | 中文一区二区 | 久草免费在线视频 | av免费看在线 | 成人性生交大片免费看中文带字幕 | 中文字幕一区二区三区四区不卡 | 欧美一区两区 | 在线视频91 | 黑人精品xxx一区一二区 | 日韩一二区在线 | 成人午夜高清 | 亚洲一区国产 | 日韩国产中文字幕 | 99精品视频在线观看 | 国产精品一区二区在线 | 久久久久国产一区二区三区 | 久久不射电影网 | 国产精品亚洲一区二区三区在线 | 日一区二区 | 男女羞羞免费视频 | 一区二区三区免费 |