1
我想加載一個UIView,第一次加載我的應用程序。 但我無法做到這一點。在applicationdidFinishLaunching中加載UIView
這裏是我的applicationDidFinishLaunching方法:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if(![[NSUserDefaults standardUserDefaults] boolForKey:@"AlreadyRan"]) {
[[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:@"AlreadyRan"];
// proceed to do what you wish to only on the first launch
NarrativeView *narView = [[NarrativeView alloc] initWithNibName:@"NarrativeView" bundle:nil];
[window addSubview:narView.view];
[window makeKeyAndVisible];
[narView release];
} else
{
// Override point for customization after application launch.
[window addSubview:rootController.view];
[window makeKeyAndVisible];
}
return YES;
}
有人能幫助我嗎?
您是否遇到任何錯誤,或者您的測試「AlreadyRan」總是失敗,因此您的代碼沒有執行? – 2010-10-04 20:32:20