Created
March 14, 2009 19:14
-
-
Save metaskills/79148 to your computer and use it in GitHub Desktop.
This file contains 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
- (id)initWithCoder:(NSCoder *)coder { | |
if (self = [super initWithCoder:coder]) { | |
self.teams = [NSMutableArray | |
arrayWithObjects: @"Anaheim Aardvarks", | |
@"Baltimore Bats", | |
@"California Caterpillars", | |
@"Denver Donkeys", | |
nil]; | |
self.addButtonItem = [[[UIBarButtonItem alloc] | |
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonWasPressed)] | |
autorelease]; | |
NSLog(@"teams RC: %d", [self.teams retainCount]); | |
} | |
return self; | |
} | |
- (void)dealloc { | |
[teams release]; | |
[addButtonItem release]; | |
[super dealloc]; | |
} |
This file contains 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
#import <UIKit/UIKit.h> | |
@interface RootViewController : UITableViewController { | |
NSMutableArray *teams; | |
UIBarButtonItem *addButtonItem; | |
} | |
@property (nonatomic, retain) NSMutableArray *teams; | |
@property (nonatomic, retain) UIBarButtonItem *addButtonItem; | |
- (IBAction)addButtonWasPressed; | |
@end | |
This file contains 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
NSMutableArray *foo = [NSMutableArray arrayWithObjects:@"one",nil]; | |
NSLog(@"foo RC: %d", [foo retainCount]); // 1 | |
[foo autorelease]; | |
NSLog(@"foo RC: %d", [foo retainCount]); // 1 | |
self.teams = foo; | |
NSLog(@"foo RC: %d", [foo retainCount]); // 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment