当视图控制器从导航控制器弹出时应用程序崩溃
我正在导航控制器上推送一个对象,但是当我从该视图控制器返回控制时,它会使应用程序崩溃。
[self.navigationController pushViewController:chequeDetails animated:YES];
[chequeDetails release];
但是当我用应用程序编写相同的代码时
[self.navigationController pushViewController:chequeDetails animated:YES];
chequeDetails=nil;
[chequeDetails release];
不会崩溃,但会观察到轻微的滞后......当我从检查详细信息控制器弹出时?
I am pushing an object on navigation controller but when I return the control from the that view controller it crashes the app.
[self.navigationController pushViewController:chequeDetails animated:YES];
[chequeDetails release];
but when I write the same code with
[self.navigationController pushViewController:chequeDetails animated:YES];
chequeDetails=nil;
[chequeDetails release];
The app does not crash but a slight lag is observed... when i pop back from the check details controller?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的秒示例代码,您不会释放
chequeDetails
因为在 nil 对象上调用release
不会执行任何操作:通常您可以这样做:
但只释放 < code>chequeDetails 如果您进行了分配,则 init 如下:
所以完整的代码应该类似于:
If your seconds exaple code, you are not release the
chequeDetails
since callingrelease
on a nil object does not nothing:Normally you can do it this ways:
But only release the
chequeDetails
if you did a alloc, init like:So the full code should be something like:
我不知道 Exat...但我认为您需要创建委托的对象,并且需要编写 appDelegate.navigationController 而不是 self.navigationController...
注意:appDelegate 是 Delegate 的对象。
I dont Know Exat... but i think you need to create a object of your delegate and you need to write appDelegate.navigationController rather then self.navigationController...
Note: appDelegate is a object of Delegate.