- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation
==UIInterfaceOrientationPortraitUpsideDown)) {
return YES;
} else {
return NO;
}
}
the other possible states are UIInterfaceOrientationLandscapeLeft or UIInterfaceOrientationLandscapeRight.if ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation
==UIInterfaceOrientationPortraitUpsideDown)) {
return YES;
} else {
return NO;
}
}
You should also set the view mode in the view's Attribute inspector on the storyboard.