Created
August 22, 2010 06:18
-
-
Save whalec/543413 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AViewController.h | |
@interface AViewController : UIViewController | |
{ | |
} | |
@property(readwrite, retain) NSString *aString; | |
@property(readwrite, assign, getter=isReady) BOOL ready; | |
# AViewController.m | |
@implementation AViewController | |
@synthesize aString = _aString; | |
- (void)viewDidLoad | |
{ | |
# By doing this you avoid many of the headaches and pitfalls of | |
# managing memory. | |
self.aString = @"A string that is now retained"; | |
self.ready = NO; | |
} | |
- (void)someAction | |
{ | |
if (self.isReady) | |
NSLog(self.aString); | |
} | |
- (void)dealloc | |
{ | |
self.aString = nil, [_aString release]; | |
[super dealloc]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment