gpt4 book ai didi

iphone - PushViewController 无法通过 AppDelegate 工作

转载 作者:行者123 更新时间:2023-11-29 03:53:08 25 4
gpt4 key购买 nike

我想通过警报 View 从 AppDelegate 推送到 View Controller 。但它不起作用。只有警报 View 会关闭。哪里有问题?先谢谢您的帮助。 (注意>我的初始 View 在 Storyboard中,但我正在插入 View Controller Nib )

- (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];

}
}

最佳答案

试试这个:

SignUp *signUp = [[SignUp alloc]initWithNibName:@"SignUp" bundle:nil];                
self.navigationController = [[UINavigationController alloc] initWithRootViewController:signUp];
self.window.rootViewController = self.navigationController;

关于iphone - PushViewController 无法通过 AppDelegate 工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16831768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com