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

IOS:在滾動視圖中添加圖像視圖以進(jìn)行縮放

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

問題描述

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

解決方案

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

    <塊引用>

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

  7. 運(yùn)行應(yīng)用程序并捏合和平移,直到心滿意足.

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.

這篇關(guān)于IOS:在滾動視圖中添加圖像視圖以進(jìn)行縮放的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

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(以編程方式設(shè)置 contentOffset 觸發(fā) scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁面之間的照片應(yīng)用程序式間隙)
why UIScrollView is leaving space from top in ios 6 and ios 7(為什么 UIScrollView 在 ios 6 和 ios 7 中從頂部留下空間)
UIScrollView pauses NSTimer while scrolling(UIScrollView 在滾動時(shí)暫停 NSTimer)
主站蜘蛛池模板: 91精品国产综合久久精品 | 日本韩国欧美在线观看 | 免费在线成人 | 日韩欧美一级片 | 在线黄色网 | 亚洲欧美日韩精品久久亚洲区 | 欧美日韩国产在线观看 | 久久久91精品国产一区二区三区 | 全免费a级毛片免费看视频免 | 日本不卡一区二区三区在线观看 | 亚洲精品日韩视频 | 在线一区 | 欧美日韩亚洲视频 | 国产999精品久久久久久绿帽 | av喷水| 日韩毛片免费看 | 中文字幕 在线观看 | 亚洲视频在线播放 | 日本不卡在线视频 | 日韩中文字幕 | 欧美国产日韩一区 | 一区二区在线观看免费视频 | av网站免费 | 日韩爱爱网站 | 成人在线精品视频 | 伊人看片 | 隔壁老王国产在线精品 | 欧美性网| 国产一级视频在线播放 | 亚洲精品成人网 | 激情欧美一区二区三区中文字幕 | 欧洲精品一区 | 午夜精品久久久 | 国产欧美一区二区三区日本久久久 | 久久久精品网 | 欧美日韩高清 | 中文字幕电影在线观看 | 青青久草| 国产精品久久久久久婷婷天堂 | 国产精品伦一区二区三级视频 | 美女天堂|