【发布时间】:2014-03-19 14:57:32
【问题描述】:
我有一个包含 UICollectionView 的 UIViewController。在点击任何 UICollectionViewCell 时,我会呈现一个模态视图控制器。
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PopViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"DetailsView"];
vc.view.backgroundColor = [UIColor clearColor];
vc.transitioningDelegate = self;
vc.modalPresentationStyle = UIModalPresentationCustom;
[self presentViewController:vc animated:YES completion:nil];
PopViewController 正确显示。现在我想在呈现 PopViewController 时限制设备方向。也就是说,如果 PopViewController 以纵向模式呈现,那么即使我切换到横向模式(在模拟器中使用向左或向右旋转),它也不应该变为横向,直到我关闭 PopViewController。
我在 PopViewController 中使用了以下代码:
-(BOOL)shouldAutorotate {
return NO;
}
还需要什么(或替代)将弹出视图锁定到当前方向?
【问题讨论】:
标签: cocoa ios7 popover screen-rotation