我是 iPhone 开发者的新手,
我的应用程序中有4
页面,我的应用程序是viewBasedApplication
.
我将我的第一页(LicAppViewController
)设为RootViewController
,这是我的代码。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.viewController = [[[LicAppViewController alloc] initWithNibName:@"LicAppViewController" bundle:nil] autorelease];
UINavigationController *navigationController=[[UINavigationController alloc] initWithRootViewController:self.viewController];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}
在按钮上单击我导航到第二页(PlanPage
)
-(void)btnClicked{
PlanPage *viewController = [[PlanPage alloc]initWithNibName:@"PlanPage" bundle:nil];
[UIView beginAnimations:@"Flip" context:nil];
[UIView setAnimationDuration:0.7];
[UIView setAnimationCurve:UIViewAnimationOptionCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:viewController animated:YES];
[UIView commitAnimations];
[viewController release];
}
到目前为止它工作正常,但是当我在第二页中选择一行时,它会使我的应用程序崩溃,我想导航到第三页(DetailPlanPage
),这是我的代码
DetailPlanPage *nextController = [[DetailPlanPage alloc] initWithNibName:@"DetailPlanPage" bundle:nil];
[self.navigationController presentModalViewController:nextController animated:TRUE];
但是当我写的时候,这一行:
[self.navigationController pushViewController:nextController animated:YES];
代替:
[self.navigationController presentModalViewController:nextController animated:TRUE];
它工作正常。(我不确定,但我的应用程序崩溃可能是因为基于视图的应用程序)
提前致谢 !