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

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

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

問(wèn)題描述

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

解決方案

  1. 將您的視圖控制器設(shè)置為 <UIScrollViewDelegate>
  2. UIScrollView 繪制為視圖中心矩形所需的大小.將檢查器中的最大縮放設(shè)置為大于 1 的值.例如 4 或 10.
  3. 右鍵單擊滾動(dòng)視圖并將代理連接到您的視圖控制器.
  4. UIScrollView 中繪制您的 UIImageView 并使用您想要的任何圖像進(jìn)行設(shè)置.使其與 UIScrollView 的大小相同.
  5. Ctrl + 將 UIImageView 拖動(dòng)到 View 控制器的 .h 中,為 UIImageView 創(chuàng)建一個(gè) IBOutletcode>,把它稱(chēng)為 imageView 之類(lèi)的聰明東西.
  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:在滾動(dòng)視圖中添加圖像視圖以進(jìn)行縮放的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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 - 如何從照片庫(kù)中獲取最后拍攝的 3 張照片?)
Setting contentOffset programmatically triggers scrollViewDidScroll(以編程方式設(shè)置 contentOffset 觸發(fā) scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁(yè)面之間的照片應(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 在滾動(dòng)時(shí)暫停 NSTimer)
主站蜘蛛池模板: 日韩2020狼一二三 | 国产日韩欧美在线 | 精品天堂| 欧美成年网站 | 一区在线播放 | 成人1区2区 | 五月激情综合 | 午夜影院在线观看视频 | 综合网在线| 在线中文视频 | 日韩在线观看网站 | 久草成人 | 国产综合精品一区二区三区 | 一区二区三区在线观看免费视频 | 日韩三级 | 日韩av一区二区在线观看 | 亚洲第一视频网站 | jvid精品资源在线观看 | 99久久久久 | av网站在线播放 | 一区二区三区四区不卡 | 亚洲www啪成人一区二区麻豆 | 日韩在线观看视频一区 | 超碰欧美 | 精品一区二区免费视频 | 精品国模一区二区三区欧美 | 天天干.com| 婷婷激情在线 | 国产精品成人69xxx免费视频 | 国产精品视频999 | 日韩欧美一区二区三区在线播放 | 一区二区三区四区日韩 | 日韩在线观看一区 | 免费激情av | 日韩 欧美 二区 | 欧美国产精品一区二区 | 很很干很很日 | 99免费看 | 四虎午夜剧场 | 久在线| 一区二区三区四区在线视频 |