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

您不能从 App Delegate 中推送,而是可以UIViewController根据用户从UIAlertView.

self.window.rootViewController = self.navController;
于 2013-05-30T08:59:54.753 回答
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
- (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 回答