Master-Detail Xcode 项目中的默认代码片段
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController; // *** here ***
MasterViewController *controller = (MasterViewController *)navigationController.topViewController;
controller.managedObjectContext = self.managedObjectContext;
return YES;
}
AppDelegate.h
@property (strong, nonatomic) UIWindow *window;
我知道@synthesize 只是设置访问器方法,并且不会自动进行初始化。但是,如果从未显式初始化,window
非零怎么办?rootViewController
这只是 Xcode 在幕后初始化吗?