Hello, on Appdelegate. h add
@property (nonatomic , assign) bool blockRotation;
and in Appdelegate. m
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (self.blockRotation) {
return UIInterfaceOrientationMaskPortrait;
}
return UIInterfaceOrientationMaskAll;
}
And in the views you want to disable the rotation, just add
- (void)viewDidLoad
{
[super viewDidLoad];
AppDelegate* shared=[UIApplication sharedApplication].delegate;
shared.allowRotation=YES;
}
-(void)viewWillDisappear:(BOOL)animated{
AppDelegate* shared=[UIApplication sharedApplication].delegate;
shared.allowRotation=NO;
}
Another way is to add each view to the check
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationPortrait)
return YES;
return NO;
}
Source:https://stackoverflow.com/questions/5296399/ios-how-to-stop-view-rotate
Do you want this to support all guidelines or just "landscape"?
– DaSilva
All guidelines
– Gian