Ways to initialize a retained property


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Give a retained property
  2. @property (retain) UILabel label;
  3.  
  4.  
  5. // I believe that the following initializations
  6. // are equivalent and correct.
  7.  
  8. /////////////
  9. UILabel *tmpLabel = [[UILabel alloc] init];
  10. self.label = tmpLabel;
  11. [tmpLabel release];
  12.  
  13. /////////////
  14. self.label = [[[UILabel alloc] init] autorelease];
  15.  
  16. /////////////
  17. label = [[UILabel alloc] init];

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.