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

IOS:在滾動視圖中添加圖像視圖以進行縮放

IOS: add imageview in a scrollview to have zoom(IOS:在滾動視圖中添加圖像視圖以進行縮放)
本文介紹了IOS:在滾動視圖中添加圖像視圖以進行縮放的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想用 UIImage 設置 UIImageView 并將這個 imageview 放在 UIScrollView 中以獲得這個圖像的縮放;我希望這個 UIImageViewUIScrollView 適合視圖中心的矩形...有可能嗎?

解決方案

  1. 將您的視圖控制器設置為 <UIScrollViewDelegate>
  2. UIScrollView 繪制為視圖中心矩形所需的大小.將檢查器中的最大縮放設置為大于 1 的值.例如 4 或 10.
  3. 右鍵單擊滾動視圖并將代理連接到您的視圖控制器.
  4. UIScrollView 中繪制您的 UIImageView 并使用您想要的任何圖像進行設置.使其與 UIScrollView 的大小相同.
  5. Ctrl + 將 UIImageView 拖動到 View 控制器的 .h 中,為 UIImageView 創建一個 IBOutletcode>,把它稱為 imageView 之類的聰明東西.
  6. 添加此代碼:

    <塊引用>

    -(UIView *) viewForZoomingInScrollView:(UIScrollView *)scrollView{返回self.imageView;}

  7. 運行應用程序并捏合和平移,直到心滿意足.

I want to set a UIImageView with a UIImage and put this imageview inside a UIScrollView to obtain a zoom of this image; and I want this UIImageView and UIScrollView to fit in the rect at the center of the view...is it possible?

解決方案

  1. Set your view controller up as a <UIScrollViewDelegate>
  2. Draw your UIScrollView the size you want for the rectangle at the center of the view. Set the max zoom in the inspector to something bigger than 1. Like 4 or 10.
  3. Right click on the scroll view and connect the delegate to your view controller.
  4. Draw your UIImageView in the UIScrollView and set it up with whatever image you want. Make it the same size as the UIScrollView.
  5. Ctrl + drag form you UIImageView to the .h of your View controller to create an IBOutlet for the UIImageView, call it something clever like imageView.
  6. Add this code:

    -(UIView *) viewForZoomingInScrollView:(UIScrollView *)scrollView
    {
        return self.imageView;
    }
    

  7. Run the app and pinch and pan til your heart's content.

這篇關于IOS:在滾動視圖中添加圖像視圖以進行縮放的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
主站蜘蛛池模板: 亚洲精品18 | 一区二区三区电影网 | 欧美久久久 | 亚洲精品粉嫩美女一区 | 一二三四av | 国产成人一区二区三区久久久 | 亚洲视频二区 | 国产一区二区在线91 | 久久久久久久久久久91 | 精品国产一区二区三区久久影院 | 色视频网站 | 亚洲色欲色欲www | 国产精品一区一区三区 | 久久午夜国产精品www忘忧草 | 成人二区 | 黑人巨大精品欧美一区二区一视频 | 国产成人免费在线观看 | 国产精品国产精品国产专区不片 | 高清视频一区二区三区 | 伊人焦久影院 | 欧美三级久久久 | 91精品国产91久久久久久吃药 | 国产女人叫床高潮大片免费 | 中国一级特黄真人毛片 | 成人h电影在线观看 | 久久99精品久久久久子伦 | 久久久精品久久 | 欧美极品少妇xxxxⅹ免费视频 | 热久久999 | 欧美成人精品二区三区99精品 | 精品亚洲一区二区三区四区五区 | 日韩欧美三区 | 午夜精品久久久久久久星辰影院 | 中文字幕在线视频网站 | 中文字幕一区在线 | 国产免费又黄又爽又刺激蜜月al | 日韩亚洲一区二区 | 国产美女精品 | 福利视频网站 | 国产一区二区在线免费视频 | 精品一区二区三区在线观看 |