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

UIImageView/UIImage“內存標簽70"滾動時的釋放時

UIImageView/UIImage quot;Memory Tag 70quot; release timing when scrolling(UIImageView/UIImage“內存標簽70滾動時的釋放時機)
本文介紹了UIImageView/UIImage“內存標簽70"滾動時的釋放時機的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個長的水平分頁滾動視圖,對于每個頁面,我都放了一個全屏 UIImage.

I have a long horizontal paged scrollview, for each page, I put a fullscreen UIImage.

由于價格昂貴且無需一次添加所有 UIImage,目前我延遲加載圖像(pageIndex-1 + pageIndex + pageIndex+1 的圖像,使用 NSOperationQueue 僅供參考),并刪除所有其他 UIImageViews.

As it is expensive and not necessary to add all UIImage at once, currently I lazy load the images (pageIndex-1 + pageIndex + pageIndex+1 's images, using NSOperationQueue FYI), and remove all other UIImageViews.

Instrument 報告的內存使用情況在正常使用情況下是可以接受的,但我發現如果我繼續滾動(連續在 30 頁之間切換),臟內存會不斷增加,尤其是內存標簽 70",我認為它是原始的來自 UIImage 的數據.一旦我停止觸摸應用程序 3~4 秒,所有內存標簽 70"都會自動釋放.

The memory usage reported from Instrument is acceptable with normal usage, but I discover if I keep scrolling (switching between 30 pages continously), the Dirty memory would keep increasing, especially "Memory Tag 70" which I believe it is the raw data from UIImage. Once I stop touching the app for 3~4 seconds, ALL "Memory Tag 70" would be released automagically.

我已將 NSLog 放在多個位置,并且我確信當 UIImageViews 超出顯示范圍"時,它會從其父視圖中刪除.

I've put NSLog in several places and I'm sure the UIImageViews are removed from its superview when it is out of the "display range".

滾動是否會阻止主循環釋放這些內存?我能做些什么來防止這種情況發生?謝謝!

Is scrolling preventing the main loop to release those memory? What could I do to prevent such condition? Thanks!

p.s Dirty Size 的大幅下降是我停止滾動的那一刻.

p.s The huge drop in Dirty Size is the moment when I stop scrolling.

推薦答案

(只是猜測,我距離 Xcode 還差得很遠,假設是非 ARC 環境)

(Just a guess, I'm far from an Xcode to test it, and assuming a non-ARC environment)

可以使用

UIImage *image = [otherImageView.image retain];
otherImageView.image = nil;
[image release]; // the image won't go to the main autorelease pool
[otherImageView removeFromSuperview]; // No one has references to otherImageView, so it goes to the autorelease pool

為了避免圖像進入自動釋放池.

To avoid the image going to the autorelease pool.

這篇關于UIImageView/UIImage“內存標簽70"滾動時的釋放時機的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
How can i add more than 10 buttons on a navigationbar in iphone application development?(如何在 iphone 應用程序開發中的導航欄上添加 10 多個按鈕?)
Using UITouch inside a UIScrollView(在 UIScrollView 中使用 UITouch)
laying out images in UIScrollView automatically(自動在 UIScrollView 中布局圖像)
Scroll a background in a different speed on a UIScrollView(在 UIScrollView 上以不同的速度滾動背景)
主站蜘蛛池模板: 久久久久一区二区三区 | 精品久久久久久久 | 古装三级在线播放 | 颜色网站在线观看 | 日韩欧美一区二区三区四区 | 天天干视频| 日韩在线看片 | 国产高清精品一区二区三区 | 一区二区三区国产 | 蜜臀网| 美女久久 | 狠狠入ady亚洲精品经典电影 | 成人二区三区 | 欧美激情视频一区二区三区免费 | 成人综合一区二区 | 精品久久久一区 | 成人免费视频观看 | 国产一区二区三区久久久久久久久 | 成人一区二区视频 | 国产在线视频三区 | 小早川怜子xxxxaⅴ在线 | 中国一级大黄大片 | 久久久久国产精品www | 特黄视频 | 精品国产一区二区三区久久狼黑人 | 国产精品资源在线 | 久久久久91| 免费a级毛片在线播放 | 国产精品一级在线观看 | 国产精品.xx视频.xxtv | 96av麻豆蜜桃一区二区 | 亚洲电影一级片 | 91精品国产麻豆 | 久久丁香 | 91免费小视频 | 一区二区三区视频在线观看 | 国产在线视频网 | 一区二区高清在线观看 | 成人av高清在线观看 | 一本一道久久a久久精品蜜桃 | 在线观看www|