代码:
HDComposeViewController *vc = [[HDComposeViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:nav animated:YES];
当设备旋转时,当前模态视图无法旋转。如果我将modalPresentationStyle
更改为UIModalPresentationFormSheet
,则会有效!
HDComposeViewController已经实现了旋转委托:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (BOOL)shouldAutorotate
{
return YES;
}
有什么不对吗?感谢。
答案 0 :(得分:0)
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
-(BOOL)shouldAutorotate
{
return YES;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
答案 1 :(得分:0)
您需要为导航控制器添加一个类别,以便在ios 6中旋转。
@interface UINavigationController (RotationAll)
-(NSUInteger)supportedInterfaceOrientations;
@end
@implementation UINavigationController (RotationAll)
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
@end