久久久久久久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)
主站蜘蛛池模板: 亚洲一区亚洲二区 | 97久久超碰 | 欧产日产国产精品99 | 精品国产一区二区三区久久影院 | 日韩专区中文字幕 | 看av网| 国产日产久久高清欧美一区 | 人人做人人澡人人爽欧美 | 国产一区二区精品在线观看 | 一区二区三区高清不卡 | 国产福利在线播放 | 欧美成人a| 午夜精品导航 | 亚洲每日更新 | 91成人在线视频 | 天天躁人人躁人人躁狂躁 | 欧美日韩中文在线 | www.av在线| 自拍偷拍中文字幕 | 日本高清中文字幕 | 国产成人精品久久 | 亚洲精品一区中文字幕乱码 | 免费a级毛片在线播放 | 久久久久久久国产精品影院 | 91婷婷韩国欧美一区二区 | 国产精品日产欧美久久久久 | 成人av网站在线观看 | 女人一区 | 91久久久久久 | 美女久久视频 | 成人在线观看黄 | 精品视频一区二区三区四区 | www.国产视频 | 国产精品一二区 | 欧美精品久久久久 | 国产一级视屏 | 在线91| 黄视频网址 | 国产伦一区二区三区 | 日韩免费视频一区二区 | 四虎在线观看 |