0
我只是不明白我在做什麼錯。我有2個不相關的視圖控制器,我通過將視圖控制器拖動到屏幕創建了storyboard
。每個在故事板中都有它的名稱標識符,我用它們的名字在它們之間進行替換。如何正確替換視圖控制器
問題是,在第一次更換後,我得到了與現實無關的數十條內存警告,因爲我的內存消耗約爲59M,並保持這種狀態。當我從A切換到B並且回到A時,有時它會由於「記憶湖」而失敗(59M !!)。
當我更換視圖控制器時,我做錯了什麼?
- (IBAction)goMatrix:(id)sender
{
UIViewController *mainV=[self.storyboard instantiateViewControllerWithIdentifier:@"MatrixView"];
mainV.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:mainV animated:YES completion:^(void)
{
scroller.delegate=nil;
scroller=nil;
[imagesBuffer removeAllObjects];
[scroller removeFromSuperview];
[stripView removeFromSuperview];
}];
}
我對他們兩人與圖像的滾動視圖,我剛剛從上海華刪除,我只是不明白還有什麼能做些什麼來真的乾淨的東西了(雖然內存只有59M )
- 唯一的那一刻,我有高記憶是,當我代替他們,而其僅爲1秒(134M!)
我不知道我明白你說的「可以使用」的意思是,我該怎麼辦,他的代碼?我必須能夠從B代替A,而不是從A代替B,我將如何做到這一點,以及我目前的代碼有什麼問題? – Curnelious
更新後的代碼是否更清晰? – Raptor
我不認爲與故事板,你需要使用setRootViewController或makrKeyAndVisible,因爲故事板爲你做這個。只是在appdelegate中定義的窗口並在applicationdidfinishlaunching中返回YES。 – Pawan