<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > iOS目前版本的內存管理差異有哪些呢?

iOS目前版本的內存管理差異有哪些呢?

作者: 時(shí)間:2016-10-29 來(lái)源:網(wǎng)絡(luò ) 收藏

本文引用地址:http://dyxdggzs.com/article/201610/306006.htm

說(shuō)到技術(shù)那么大家都知道版本的升級那是在所難免的了,那么如果你是在學(xué)習的話(huà)那么也會(huì )有些關(guān)于版本的問(wèn)題,這不前兩天就有同學(xué)問(wèn)老師:iOS目前版本的差異有哪些呢?如下就是我贏(yíng)職場(chǎng)老師給學(xué)員的解答,由尚網(wǎng)小編整理希望對大家有所幫助。

iOS6.0以前版本

1

收到內存警告:調用 didReceiveMemoryWarning 內調用 super 的 didReceiveMemoryWarning 會(huì )將 controller 的 view 進(jìn)行釋放。所以我們不能將controller的view再次釋放。

處理方法:

-(void)didReceiveMemoryWarning

{

[super didReceiveMemoryWarning];//如沒(méi)有顯示在window上,會(huì )自動(dòng)將self.view釋放。

// 6.0以前,不用在此做處理,self.view釋放之后,會(huì )調用下面的viewDidUnload函數,在viewDidUnload函數中做處理就可以了。

}

-(void)viewDidUnload

{

// Release any retained subviews of the main view.不包含self.view

[super viewDidUnload];

//處理一些內存和資源問(wèn)題。

}但是到了IOS 6.0之后,這里又有所變化,IOS 6.0內存警告的 viewDidUnload 被屏蔽,即又回到了IOS 6.0以前版本時(shí)期的方式。

收到內存警告:調用 didReceiveMemoryWarning 內調用 super 的 didReceiveMemoryWarning 調只是釋放 controller 的 resouse,不會(huì )釋放view。

處理方法:

-(void)didReceiveMemoryWarning

{

[super didReceiveMemoryWarning];//即使沒(méi)有顯示在window上,也不會(huì )自動(dòng)的將self.view釋放。

// Add code to clean up any of your own resources that are no longer necessary.

// 此處做兼容處理需要加上ios6.0的宏開(kāi)關(guān),保證是在6.0下使用的,6.0以前屏蔽以下代碼,否則會(huì )在下面使用self.view時(shí)自動(dòng)加載viewDidLoad

if ([self.view window] == nil)// 是否是正在使用的視圖

{

// Add code to preserve data stored in the views that might be

// needed later.

// Add code to clean up other strong references to the view in

// the view hierarchy.

self.view = nil;// 目的是再次進(jìn)入時(shí)能夠重新加載調用viewDidLoad函數。

}



關(guān)鍵詞: ios 內存管理

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>