How to lock changing orientation on device?
I tried to use
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationLandscapeRight;
}
and this
- (void)viewDidAppear:(BOOL)animated
{
[self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeRight];
[super viewDidAppear:animated];
}
but nothing work when i use device. When app runs on simulator it works great.
simulator have iOS 6 and device 5.1.1. What i’m doing wrong?
Try this:
The method returns YES or NO answering the question “should I rotate to this orientation: interfaceOrientation”.
So you should return YES or NO –
UIInterfaceOrientationLandscapeRightis not a BOOL.But you can use a comparison to return the BOOL like described above.