这是示例代码。
if(MyPageViewControllerObj==nil)
{
MyPageViewController *vController = [[MyPageViewController alloc] initWithNibName:@"MyPageView" bundle:[NSBundle mainBundle]];
self.MyPageViewControllerObj=vController;
[vController release];
noOfWrongAnswers=0;
noOfRightAnswers=0;
}
MyPageViewControllerObj.sessionid=sessionid;
MyPageViewControllerObj.categoryID = categoryId;
MyPageViewControllerObj.flashcardIdforcount = flashcardid;
MyPageViewControllerObj.categoryType=categoryType;
MyPageViewControllerObj.indexViewControllerobj=self;
[self.navigationController pushViewController:MyPageViewControllerObj animated:YES];
我需要写这行**** [MyPageViewControllerObj release] ****
将其推入导航控制器之后,以及dealloc方法......
答案 0 :(得分:3)
是的,您应该释放MyPageViewControllerObj
,因为UINavigationController
会保留它。它不需要在-dealloc
方法中。