ios下presentModalViewController产生的错误。

在调试代码的时候,遇到这样的一种情况, 用model方式弹出一个 controller. 代码如下

systemstyleViewController * s = [[systemstyleViewController alloc]init];

    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:s];  

    s.modalPresentationStyle = UIModalPresentationFormSheet ;

    s.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal ;

    [self presentModalViewController:s animated:YES] ;


曝出的错误是

Application tried to present modally an active controller


如果把UINavigationController这行屏蔽掉后,程序能正常运行。 

//  UINavigationController *nav = [[UINavigationController allocinitWithRootViewController:s];


猜想可能是生成Navigationcontroller后,系统就认为它是active的了

但是push却可以

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

你可能感兴趣的:(iphone开发)