久久久久久久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 上以不同的速度滾動背景)
主站蜘蛛池模板: 高清成人av | 我爱操 | 做a的各种视频 | 国产日韩欧美 | h免费观看 | 一区二区精品 | 九九久久久 | av福利网站 | 国产激情一区二区三区 | 中文字幕亚洲一区 | 欧美伊人| 91免费在线看 | 在线一区| 精品一二三区 | 91大神在线看 | 日韩 欧美 综合 | 福利片在线观看 | 不卡在线视频 | 一区二区在线 | 国产乱码精品一区二区三区中文 | 在线免费国产 | 久热国产精品 | av黄色免费在线观看 | 国产在线一区二区 | 精品久久久久久亚洲精品 | 国产成人精品网站 | 久久国内精品 | 欧美综合一区二区三区 | 狠狠爱免费视频 | 欧美综合一区二区三区 | 激情自拍偷拍 | 日韩亚洲视频 | 九色av| 欧美一级二级在线观看 | 麻豆一区二区三区精品视频 | 欧美黄色大片在线观看 | av第一页 | 成人精品毛片国产亚洲av十九禁 | 亚洲综合无码一区二区 | 亚洲国产日韩欧美 | 精品一区二区久久久久久久网站 |