0
我得到一個內存泄漏警告與UITabbarcontroller。解決內存泄漏會阻止我的UI顯示iphone
如果我釋放tabbarcontroller警告消失,但使用TabBar將不會顯示任何內容。如果我調試應用程序與警告仍然處於它的應用程序運行,但一兩分鐘
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.view.frame = CGRectMake(0, 0, 320, 460);
tabBarController.viewControllers=localControllersArray;
// Clean up objects we don't need anymore
[promoTabOptionHome release];
[promoTabOptionInfo release];
[promoTabOptionEvents release];
[promoTabOptionBuy release];
[localControllersArray release];
// Finally, add the tab controller view to the parent view
[self.view addSubview:tabBarController.view];
//[tabBarController release]; commenting out this line removes the warning but results in no content being shown
我使標籤欄控制器成爲該類的成員,並將其設置爲在dealloc函數中釋放。 謝謝 – dubbeat 2010-04-29 11:06:55