Iterate attributes and IBOutlets of a UIViewController

Posted by Espuz on Stack Overflow See other posts from Stack Overflow or by Espuz
Published on 2010-06-02T10:02:47Z Indexed on 2010/06/02 10:03 UTC
Read the original article Hit count: 183

Filed under:
|

I've a generic UIViewController on my app. All the UIViewController on the app inherits from this generic one.

I'm trying to automate the deallocation and releasing of attributes and IBOutlets as properties.

I'm doing the first (attributes) on dealloc method and the second (IBOutlets as properties) on viewDidUnload.

- (void) dealloc {
  [_att1 release];
  _att1 = nil;

  [_att2 release];
  _att2 = nil;

  // ...
}

- (void) viewDidUnload {
   self.att1 = nil; // att1 is an IBOutlet
   self.att2 = nil; // att2 is an IBOutlet

   // ...
}

Is there any way to iterate all my attributes and IBOutlets to simplify this operations? I want to avoid do it for each outlet and attribute and delegate it to the generic UIViewController.

Thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about memory-management