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

啟用分頁和縮放的 UIScrollView 圖像/照片查看器

UIScrollView image/photo viewer with paging enabled and zooming(啟用分頁和縮放的 UIScrollView 圖像/照片查看器)
本文介紹了啟用分頁和縮放的 UIScrollView 圖像/照片查看器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

好的,我認(rèn)為是時候在互聯(lián)網(wǎng)上為這個問題建立一個官方位置了:How to make a UIScrollView photoviewer with paging and zooming.歡迎我的 UIScrollView 黑客伙伴.

我有一個啟用分頁的 UIScrollView,并且我正在顯示 UIImageViews,就像內(nèi)置的照片應(yīng)用程序一樣.(這聽起來是不是很熟悉?)

我在github上找到了以下項目:

https://github.com/andreyvit/ScrollingMadness/wiki

這顯示了如何在啟用分頁時在滾動視圖中實現(xiàn)縮放.如果其他人嘗試這樣做,我實際上必須刪除 UIScrollView 子類并使用本機(jī)類,否則它不起作用.我認(rèn)為這是因為 3.0 SDK 中有關(guān)滾動視圖如何攔截觸摸事件的更改.

所以想法是在開始縮放時刪除所有其他視圖,并將當(dāng)前視圖移動到 scrollview 中的 (0, 0),更新 contentsize 等等.然后當(dāng)您放大到 1.0f 時,它會重新添加其他視圖并將所有內(nèi)容恢復(fù)原狀.

無論如何,該項目在模擬器中運行良好,但在設(shè)備上,您正在調(diào)整大小的視圖有一些令人討厭的移動,這看起來是由于我們正在更改 contentsize/offset 等用于正在調(diào)整大小的視圖.您必須移動此視圖,否則您可以通過其他視圖留下的空白向左平移.

我在 3.0 SDK 發(fā)行說明:

<塊引用>UIScrollView:縮放后,內(nèi)容插入被忽略,內(nèi)容留在錯誤的位置.

這聽起來像是這里正在發(fā)生的事情.放大后,由于您更改了偏移等,視圖將移出屏幕.

我已經(jīng)在這方面花費了幾個小時,但我正在慢慢意識到這根本行不通.

Three20 的照片查看器是不可能的:它太重了,而且有太多不必要的 UI 和其他行為.

內(nèi)置的照片應(yīng)用似乎有一些魔力.如果您放大圖像并平移到遠(yuǎn)邊緣,則當(dāng)前照片會獨立于旁邊的照片移動,這不是您在使用標(biāo)準(zhǔn) UIScrollView 嘗試時所得到的.

我看過關(guān)于嵌套 UIScrollView 的討論,但我真的不想去那里.

有沒有人用標(biāo)準(zhǔn)的 UIScrollView 管理過這個(并且在 2.2 和 3.0 SDK 中工作)?我不喜歡滾動自己的縮放 + 彈跳 + 平移 + 分頁代碼.

解決方案

更新

因為下面的消息,我刪除了之前的回答……

對于那些沒有聽說過的人來說是個大新聞.Apple 已向 iphone 開發(fā)者計劃的所有成員發(fā)布了 2010 年 WWDC 會議視頻.討論的主題之一是他們?nèi)绾蝿?chuàng)建照片應(yīng)用程序!!!他們逐步構(gòu)建了一個非常相似的應(yīng)用程序,并免費提供了所有代碼.

它也不使用私有 api.這是示例代碼下載的鏈接.您可能需要登錄才能獲得訪問權(quán)限.

檢查這個

還有,這里是 iTunes WWDC 頁面的鏈接:

檢查一下

OK, I think it's time to make an official place on the internet for this problem: How to make a UIScrollView photoviewer with paging and zooming. Welcome my fellow UIScrollView hackers.

I have a UIScrollView with paging enabled, and I'm displaying UIImageViews like the built-in photos app. (Does this sound familiar yet?)

I found the following project on github:

https://github.com/andreyvit/ScrollingMadness/wiki

Which shows how to implement zooming in a scroll view while paging is enabled. If anyone else tries this out, I actually had to remove the UIScrollView subclass and use the native class otherwise it doesn't work. I think it's because of changes in the 3.0 SDK relating to how the scroll view intercepts touch events.

So the the idea is to remove all the other views when you start zooming, and move the current view to (0, 0) in the scrollview, updating the contentsize etc. Then when you zoom back to 1.0f it adds the other views back and puts things all back in order.

Anyway, that project works perfectly in the simulator, but on the device there is some nasty movement of the view you are resizing, which looks like it's caused by the fact we are changing the contentsize/offset etc. for the view being resized. You have to do this view moving otherwise you can pan left through the whitespace left by the other views.

I found one interesting note in the "Known Issues" of the 3.0 SDK release notes:

UIScrollView: After zooming, content inset is ignored and content is left in the wrong position.

This kind of sounds like what is happening here. After zooming in, the view will shift offscreen because you have changed the offset etc.

I've spent hours on this already and I'm slowing coming to the sad realization that this just isn't going to work.

Three20's photo viewer is out of the question: it's too heavy weight and there is too much unnecessary UI and other behaviour.

The built in Photo app seems to do some magic. If you zoom in on an image and pan to the far edges, the current photo moves independently of the photo next to it which isn't what you get when trying this with a standard UIScrollView.

I've seen discussion about nesting the UIScrollView's but I really don't want to go there.

Has anybody managed this with the standard UIScrollView (and works in the 2.2 and 3.0 SDK)? I don't fancy rolling my own zoom + bounce + pan + paging code.

解決方案

UPDATE

I deleted my previous answer because of the news below...

Big news for those who haven't heard. Apple has released the 2010 WWDC session videos to all members of the iphone developer program. One of the topics discussed is how they created the photos app!!! They build a very similar app step by step and have made all the code available for free.

It does not use private api either. Here is a link to the sample code download. You will probably need to login to gain access.

Check This

And, here is a link to the iTunes WWDC page:

Check This

這篇關(guān)于啟用分頁和縮放的 UIScrollView 圖像/照片查看器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

iOS - Using storyboard and autolayout to center the UIScrollView(iOS - 使用故事板和自動布局使 UIScrollView 居中)
get index or tag value from imageview tap gesture(從 imageview 點擊手勢獲取索引或標(biāo)簽值)
UIScrollView not scrolling regardless of large contentSize(無論內(nèi)容大小如何,UIScrollView 都不會滾動)
Clean autorotation transitions in a paging UIScrollView(清除分頁 UIScrollView 中的自動旋轉(zhuǎn)轉(zhuǎn)換)
UIScrollView zooming with Auto Layout(UIScrollView 使用自動布局縮放)
How to create an image from a UIView / UIScrollView(如何從 UIView/UIScrollView 創(chuàng)建圖像)
主站蜘蛛池模板: 国产精品高潮呻吟久久av野狼 | 黄色在线免费观看视频 | 精品九九 | 亚洲免费在线观看 | 黄一级| 一区二区三区四区免费视频 | 日本色婷婷| 亚洲精品视频在线播放 | 久久久久国产一区二区三区四区 | 日韩在线视频一区 | 伊人狼人影院 | 国产特一级黄色片 | 日韩一区二区三区视频 | 91久久精品日日躁夜夜躁国产 | 久久久国产精品视频 | 99精品久久 | 日韩a级片| 成人九色 | 中文字幕av在线播放 | 日韩中文字幕在线视频 | 最新中文字幕在线 | 在线免费黄色小视频 | 先锋资源亚洲 | 欧美精品首页 | 午夜在线电影网 | 日韩一区二区三区在线观看视频 | 久久伊人一区 | 久草网站 | 欧美性高潮 | 免费在线成人网 | 日韩欧美亚洲一区 | 国产精品一区二区三区四区 | 欧美一区二区网站 | 99久久精品一区二区毛片吞精 | 亚洲精彩视频在线观看 | 国产成人综合一区二区三区 | 91精品久久久 | 亚洲国产成人精品女人久久久 | 欧美日韩一区二区三区在线观看 | 久久精品中文字幕 | 国产激情视频在线 |