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

如何在 UIScrollView 中啟用縮放

How to enable zoom in UIScrollView(如何在 UIScrollView 中啟用縮放)
本文介紹了如何在 UIScrollView 中啟用縮放的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

如何在 UIScrollView 中啟用縮放功能?

How do I enable zooming in a UIScrollView?

推薦答案

答案是 這里:

滾動視圖還可以處理內容的縮放和平移.當用戶做出捏合或張開手勢時,滾動視圖會調整內容的偏移量和比例.當手勢結束時,管理內容視圖的對象應根據需要更新內容的子視圖.(請注意,手勢可以結束并且手指仍可能向下.)在手勢進行期間,滾動視圖不會向子視圖發送任何跟蹤調用.

A scroll view also handles zooming and panning of content. As the user makes a pinch-in or pinch-out gesture, the scroll view adjusts the offset and the scale of the content. When the gesture ends, the object managing the content view should update subviews of the content as necessary. (Note that the gesture can end and a finger could still be down.) While the gesture is in progress, the scroll view does not send any tracking calls to the subview.

UIScrollView 類可以有一個必須采用 UIScrollViewDelegate 協議的委托.要使縮放和平移工作,代理必須同時實現 viewForZoomingInScrollView: 和 scrollViewDidEndZooming:withView:atScale:;另外,最大(maximumZoomScale)和最小(minimumZoomScale)縮放比例必須不同.

The UIScrollView class can have a delegate that must adopt the UIScrollViewDelegate protocol. For zooming and panning to work, the delegate must implement both viewForZoomingInScrollView: and scrollViewDidEndZooming:withView:atScale:; in addition, the maximum (maximumZoomScale) and minimum (minimumZoomScale) zoom scale must be different.

所以:

  1. 您需要一個實現 UIScrollViewDelegate 并在您的 UIScrollView 實例上設置為 delegate 的委托
  2. 在您的委托上,您必須實現一種方法:viewForZoomingInScrollView:(必須返回您對縮放感興趣的內容視圖).您還可以選擇實現 scrollViewDidEndZooming:withView:atScale:.
  3. 在您的 UIScrollView 實例上,您必須將 minimumZoomScalemaximumZoomScale 設置為不同(默認為 1.0).
  1. You need a delegate that implements UIScrollViewDelegate and is set to delegate on your UIScrollView instance
  2. On your delegate you have to implement one method: viewForZoomingInScrollView: (which must return the content view you're interested in zooming). You can also implement scrollViewDidEndZooming:withView:atScale: optionally.
  3. On your UIScrollView instance, you have to set the minimumZoomScale and the maximumZoomScale to be different (they are 1.0 by default).

注意:有趣的是,如果您想打破縮放.viewForZooming... 方法中返回 nil 是否足夠?它確實打破了縮放,但一些手勢會被弄亂(兩根手指).因此,要中斷縮放,您應該將最小和最大縮放比例設置為 1.0.

Note: The interesting thing about this is what if you want to break zooming. Is it enough to return nil in the viewForZooming... method? It does break zooming, but some of the gestures will be messed up (for two fingers). Therefore, to break zooming you should set the min and max zoom scale to 1.0.

這篇關于如何在 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)
主站蜘蛛池模板: 久久精品福利视频 | 欧美日韩国产不卡 | 91社区在线观看高清 | 黄色网址在线播放 | www.狠狠操 | 毛片网在线观看 | 华丽的挑战在线观看 | 91大片| 国产欧美精品区一区二区三区 | 色毛片 | 综合久久综合久久 | 午夜日韩视频 | 国产精品一区二 | 亚洲国产免费 | 艹逼网| 人人干在线 | 亚洲色在线视频 | 成人精品一区二区三区四区 | av在线免费观看网址 | 亚洲精品免费视频 | 亚洲欧美日韩在线一区二区 | 91精品久久久久久久久 | 蜜桃av一区二区三区 | 一区二区三区视频在线 | 在线观看成年人视频 | 男人天堂手机在线视频 | 日本黄色短片 | 国产一级久久久久 | 久久a久久| 九九热在线免费视频 | 成人精品高清 | 免费视频一区 | 免费的色网站 | 成人高清视频在线观看 | 日韩中文字幕免费 | 天天综合网91 | 天天干成人网 | 青青久久 | 日韩欧美中文字幕在线视频 | 午夜免费网站 | 久草网址|