iPhone PushViewController 发布
当我调用时:
ChooseDateView *nextController = [[ChooseDateView alloc] initWithNibName:@"ChooseDateView" bundle:nil];
[self.navigationController pushViewController:nextController animated:YES];
是否有必要调用[nextController release]?
谢谢
when i call:
ChooseDateView *nextController = [[ChooseDateView alloc] initWithNibName:@"ChooseDateView" bundle:nil];
[self.navigationController pushViewController:nextController animated:YES];
is it necessary to call [nextController release]?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,有必要调用
otherWise make 对象作为自动释放
Yes it is neccessary to call
otherWise make object as an autorelease
必须要调用【nextControllerrelease】,不然分配的内存怎么释放呢?
It is necessary to call [nextController release], otherwise how will the allocated memory be released?
是的。
内存管理规则
Yes.
Memory Management Rules
既然您已经分配了内存,那么您就是该对象的所有者。同样在分配之后,该对象将使用pushViewController 进行推送。这样我们就可以安全地释放该对象了。
由于您拥有该对象,因此必须这样做。
您也可以自动释放它。
Since you have allocated the memory, you are the owner of the object. Also after allocation, that object is pushed using pushViewController. So we can safely release the object.
and it is must to do since you own the object.
You can also autorelease it.