开发者

memory and Interface Builder objects

开发者 https://www.devze.com 2023-03-01 04:28 出处:网络
i\'m a little confused about memory managment with IB objects, here what i\'ve done: i\'ve a navigation controller, i push other view with

i'm a little confused about memory managment with IB objects, here what i've done:

  • i've a navigation controller, i push other view with

    ...[[[viewController alloc]init]autorelease]...

  • I connect EACH element of Interface Builder to a IBOutlet so defined:

    开发者_C百科@property(nonatomic, retain) IBOutlet *object

    and in .m file : @synthesize object = _object

  • Then in viewDidUnload: self.object = nil;

  • Finally in dealloc method: [_object release];

Is this a right way to manage Interface Builder object's memory?


Yes, you did everything correct.

Just one thing - you don't have to make outlets for all your UI elements, you can create them only for those you need to access in code.

0

精彩评论

暂无评论...
验证码 换一张
取 消