0

代码:

HDComposeViewController *vc = [[HDComposeViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:nav animated:YES];

当前的模态视图在设备旋转时无法旋转。如果我更改modalPresentationStyleUIModalPresentationFormSheet,它的工作原理!

HDComposeViewController 已经实现了旋转委托:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

- (BOOL)shouldAutorotate
{
    return YES;
}

有什么不对的吗?谢谢。

4

2 回答 2

0
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
    }

-(BOOL)shouldAutorotate
{
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}
于 2013-03-13T09:36:50.560 回答
0

您需要为导航控制器添加一个类别才能在 ios 6 中旋转。

@interface UINavigationController (RotationAll)
    -(NSUInteger)supportedInterfaceOrientations;
@end

@implementation UINavigationController (RotationAll)
-(NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}
@end
于 2013-03-14T20:35:27.880 回答