Exception if there is IBOutlet in view controller created by initWithNibName
When I create a Navigation-based application, the second view controller is created with initWithNibName, if I add a label ont开发者_如何学Co the second view and connect it with IBOutlet in the second view controller. After I navigate to the second view by clicking table cell, and then back to the root view, the application aborts - send message retainCount to a freed object.
I know this is caused by the IBOutlet label, which is retained, set nil in viewDidUnload and dealloc in dealloc. But I don't know why, and if I wanna still use IBOutlet, what can I do? Not dealloc it in viewcontroller's dealloc?
Anybody could help? Thank you.
holy crap, I think I didn't notice that I should release IBOutlets in view controller's dealloc rather than dealloc them.
精彩评论