我有一个UIView,当我进入横向模式时我不想旋转。但是,我不想拒绝整个视图控制器旋转,因为我有一些需要旋转的项目。非常感谢任何帮助。
答案 0 :(得分:1)
尝试从Apple Q& A查看此答案,它必须帮助您! disable rotation for a specific uiview
此功能正是您所需要的:
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)
{
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
// do whatever
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context)
{
}];
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}