私はアプリを作成し、多くのビューを持っています。アプリのマイ ビューから 1 つのビューで回転を停止するにはどうすればよいですか??
助けてもらえますか
一部のビューがUIInterfaceOrientationMaskPortraitを返さないTabViewControllerまたはNavigationControllerを使用している場合は、機能しません。すべてのViewControllerがUIInterfaceOrientationMaskPortraitを返すようにコードを変更します。
または、このカテゴリを使用できます(UINavigationControllerを使用している場合)
@interface UINavigationController (RotationPortrait)
    -(NSUInteger)supportedInterfaceOrientations;
@end
@implementation UINavigationController (RotationPortrait)
-(NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}
@end
UIViewCovtrollerビューが配置されている場所で使用しているビューコントローラーの次の機能をオーバーライドできます。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return (interfaceOrientation == UIInterfaceOrientationPortrait ||
   interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
   interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
   interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown );
}
編集
iOS 6以降の場合、以下の方法を使用してください
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;// return only the supported orientation
}