0

アラート ビューを介して AppDelegate からビュー コントローラーにプッシュしたいと考えています。しかし、うまくいきません。アラート ビューのみが閉じます。問題はどこだ?助けてくれてありがとう。(注 > 私の最初のビューはストーリーボードにありますが、ビュー コントローラーのペン先に押し込んでいます)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

loginReapeat = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(repeatLoginProcess) userInfo:nil repeats:YES];

//First Launch Settings
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FirstLaunch"])
{

}
else
{
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"FirstLaunch"];
    [[NSUserDefaults standardUserDefaults] synchronize];

    [self alertShow];
}

[window addSubview:[navigationController view]];

[window makeKeyAndVisible];

return YES;
} 

-(void)alertShow{

UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Help!" message:@"Need some help to use this App? Please tap the 'Help' button." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Help",nil];
[alert show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Help"])
{
    SignUp *signUp = [[SignUp alloc]initWithNibName:@"SignUp" bundle:nil];

    [self.navigationController pushViewController:signUp animated:YES];

}
} 
4

4 に答える 4

1

これを試して:

SignUp *signUp = [[SignUp alloc]initWithNibName:@"SignUp" bundle:nil];                
self.navigationController = [[UINavigationController alloc] initWithRootViewController:signUp];
self.window.rootViewController = self.navigationController;
于 2013-05-30T09:00:19.377 に答える
0
    SignUp *signUp = [[SignUp alloc]initWithNibName:@"SignUp" bundle:nil];                
   UINavigationController *masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:signUp ] autorelease];
    self.window.rootViewController = masterNavigationController;
于 2013-05-30T09:02:33.337 に答える
0

App Delegate 内からプッシュすることはできません。代わりにUIViewController、ユーザーがUIAlertView.

self.window.rootViewController = self.navController;
于 2013-05-30T08:59:54.753 に答える
0
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

ViewControllerName *home=[[ViewControllerName alloc] initWithNibName:@"ViewControllerName" bundle:nil];
 self.window.rootViewController=home;

navcontroller=[[UINavigationController alloc]initWithRootViewController:home];
self.window.rootViewController = self.navController.view;
[self.window makeKeyAndVisible];
return YES;

}
于 2013-05-30T09:03:53.177 に答える