Search code examples
objective-cuiviewuiviewcontrollerrelease-managementretaincount

Should I release self.view?


I have a question regarding to self.view in a UIViewController.

First, in my app, everything is created programmatically. And normally I create self.view in the loadView method:

self.view = [[UIView alloc]initWithFrame:SCREEN_FRAME]autorelease]; // SCREEN_FRAME is a constant

At this moment, the retain count of self.view is 1.

So, my question is, do I have to release self.view when I'm done with the view controller? If so, where should I release it?

Thanks very much in advance :)


Solution

  • That is being done for you by the implementation of UIViewController, just make sure you call [super dealloc] in your dealloc method.