私はアプリケーションの初回起動時にページを表示する方法を知りたいので、私はこれらの機能を持っていましたが、多くのコードを取得しましたが、私の場合は機能しません、DidFinishLaunchingメソッドでこのコードを持っています。初回起動時にUIViewControllerを表示するにはどうすればよいですか?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],@"firstLaunch",nil]];
//If First Launch
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) {
//Show help view
UIScrollView_PagingViewController *detailViewController = [[UIScrollView_PagingViewController alloc] initWithNibName:@"UIScrollView_PagingViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
else {
NSError *error = nil;
NSString *username = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
NSString *str = [SFHFKeychainUtils getPasswordForUsername:username andServiceName:@"mybibleapp" error:&error];
NSLog(@"previous user");
NSLog(@"%@", str);
if (!error && nil != str)
{
ParallelReadViewController *detailViewController = [[ParallelReadViewController alloc] initWithNibName:@"ParallelReadViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
else
{
RootViewController *detailViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
}
このコードを実行すると、白い空白の画面が表示され、何も表示されません。
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],@"firstLaunch",nil]];
//If First Launch
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) {
//Show help view
UIScrollView_PagingViewController *detailViewController = [[UIScrollView_PagingViewController alloc] initWithNibName:@"UIScrollView_PagingViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
else {
私はluck.Whatを.but起動しないように打ち上げUIScrollView_PagingViewControllerため、上記のコードを入れて、私は上記のcode.?.pleaseでのミスは私を助けています。 ありがとうございます。