在presentViewController中,定位不起作用。甚至我也在为UINavigationController使用分类。调用supportedInterfaceOrientations方法,但不进行任何更改。在Base中,shouldAutorotate方法返回YES。有以下代码的地方。
我正在使用这段代码.
ViewControllerOne *viewOne = [[ViewControllerOne alloc]init];
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:viewOne];
navCtrl.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navCtrl animated:YES completion:nil];请帮帮我。提前谢谢..。
发布于 2012-12-05 09:06:31
您使用的是哪个模拟器ios 5或ios 6?再发些代码。还可以看到这个link.
替换了appDelegate中的一行代码:
[window addSubview:viewController.view];按照这一行:
[window setRootViewController:viewController];检查iOS 5和6
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
{
[self presentViewController:navigationControllerCustom animated:YES completion:nil];
}
else
{
[self presentModalViewController:navigationControllerCustom animated:YES];
}试着使用旋转
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}https://stackoverflow.com/questions/13488717
复制相似问题