I am new in iOS and I am facing a problem regarding the rotation. I just need to lock the Single view controller rotation in portrait. I am using a code like this
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:NO];
[UIView setAnimationsEnabled:NO];
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
And this work fine in Landscape but not in the portrait.How can I used this for portrait. I have tried portrait method like this.
- UIInterfaceOrientationMaskPortrait
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationMaskPortraitUpsideDown But none work for me. Thanks in Advance!