Posted By

pmark on 03/28/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Ways to initialize a retained property


 / Published in: Objective C
 

  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  

You need to login to post a comment.