但为了这个目的,我需要推送到另一个视图我用
[self.navigationController pushViewController:info animated:YES];
但它没有推动。只是nslog只打印
- (void)applicationDidBecomeActive:(UIApplication *)application
{
//To count the number of launches
NSInteger i = [[NSUserDefaults standardUserDefaults] integerForKey:@"numOfCalls"];
[[NSUserDefaults standardUserDefaults] setInteger:i+1 forKey:@"numOfCalls"];
NSLog(@"the number of active calls are %d",i%3);
if(i%3==0 && i!=0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"you might prefer MedChart+" message:@"Get it now for more options" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok",nil];
[alert show];
[alert release];
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
NSLog(@"canceled");
}
else if (buttonIndex == 1)
{
NSLog(@"Pushed to the information view ");
InformationViewCotroller *info = [[InformationViewCotroller alloc]initWithNibName:@"InformationViewCotroller" bundle:nil];
[self.navigationController pushViewController:info animated:YES];
}
}
(不要考虑'我'的价值,这是我逻辑的一部分)。 提前致谢
答案 0 :(得分:1)
在导航到任何viewController之前,为appDelegate的navigationController设置RootController。
添加navigationController.View
作为window的子视图。然后你的根控制器将成为第一个ViewController.from,你可以推送到任何viewController。