I see the property and synthesize being used without "declaring the variable" first.. and I'm a bit confused about what properties to use. I want to alloc and init my viewController in AppDelegate and then be sure it's there for the remainder of the run. Clearly I want retain-property?.. however.. since alloc returns the viewController with retain count 1, it seams a lot smarter to just use leave the retain-property out. No other class will use my setter, so I don't care then?
Ex.
in AppDelegate.h:
@propert(nonatomic,retain) MyViewController *myViewController;
in AppDelegate.m:
@synthesize myViewController = _myViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.myViewController = [[[EventDataController alloc] init] autorelease];
[self.window makeKeyAndVisible];
return YES;
}
or..
in AppDelegate.h:
@propert(nonatomic) MyViewController *myViewController;
in AppDelegate.m:
@synthesize myViewController = _myViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.myViewController = [[EventDataController alloc] init];
[self.window makeKeyAndVisible];
return YES;
}
Set me straight, please.