iPad/iPhone orientation issue - objective-c

I realize there a many questions relating to this issue, however i have not found one that solves my issue.
To start, I have set this code in my menu.h
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES; }
The status bar changes with orientation but the views are not rotating or resizing. In order to try to narrow down my issue, I decided to try to switch two views within one .xib based on orientation
- (void)viewDidLoad {
[super viewDidLoad];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(orientationChanged:) name:#"UIDeviceOrientationDidChangeNotification" object:nil];
}
-(void) orientationChanged:(NSNotification *)object
{
UIDeviceOrientation deviceOrientation = [[object object] orientation];
if (deviceOrientation == UIDeviceOrientationLandscapeLeft || deviceOrientation == UIDeviceOrientationLandscapeRight)
{
self.view = self.landscapeView;
}
else
{
self.view = self.portraitView;
}
}
In the iOS simulator, the view definitely changes to the specific views. However the landscape view shows up as if it was portrait and sideways.
my landscape view in IB
My landscape view in the iOS simulator after changing orientation
What am I doing wrong here? I can't figure it out, any help would be greatly appreciated. Thank you in advance.
** EDIT: New Code Below **
Okay.. my issue is that the view loads properly in landscape, it's just sideways. So the Landscape view loads, just sideways. My revised code based on #Seega is:
- (void)viewDidLoad {
[super viewDidLoad];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(orientationChanged:) name:#"UIDeviceOrientationDidChangeNotification" object:nil];
[[TTNavigator navigator] setCustomTarget:self];
[[TTNavigator navigator] setCustomAction:#selector(photoAction)];
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIDeviceOrientationLandscapeLeft || toInterfaceOrientation == UIDeviceOrientationLandscapeRight)
{
self.view = self.landscapeView;
}
else
{
self.view = self.portraitView;
}
}
-(void) orientationChanged:(NSNotification *)object
{
UIDeviceOrientation deviceOrientation = [[object object] orientation];
if (deviceOrientation == UIDeviceOrientationLandscapeLeft || deviceOrientation == UIDeviceOrientationLandscapeRight)
{
self.view = self.landscapeView;
}
else
{
self.view = self.portraitView;
}
}

I would suggest putting your code in :
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
instead of making a new method. This will get called automatically if the shouldAutorotateToInterfaceOrientation method returns YES for that rotation.
Also there is a difference between UIDeviceOrientation and UIInterfaceOrientation so make sure your referencing the correct one. Your existing code would be changed to the following:
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
self.view = self.landscapeView;
}
else
{
self.view = self.portraitView;
}
Also you can use a macro to check the interface orientation keeping your code cleaner.
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation))
{
self.view = self.landscapeView;
}
else
{
self.view = self.portraitView;
}

Can you make sure, you have all the orientation support selected as follows. I tried this, and it seems to be working fine for me.

You should better simply use
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
self.view = self.landscapeView;
}
else
{
self.view = self.portraitView;
}
}
to handle the rotations instead of creating a own one.
And now you can delete all the notification stuff.

Idea!!!
If you are setting up the views in interface builder and then switching the actual view thats being displayed when the view rotates then you need to build that View in that particular orientation, not just size it to fit the orientation.
To check this:
Open your .xib in Interface Builder.
Click on the 'view' under objects so you have the whole view selected.
Look under the 'Simulated Metrics' on the right side of IB. Make sure 'Landscape' is selected in the 'Orientation' drop down.
If your view says 'Portrait' for the view you want to represent your landscapeView then it could be that xcode is rotating your landscape view to portrait and messing with your presentation.
Let me know if this helped.

Hey thank you all for your help. I had a friend help and am not entirely sure was the problem. I can tell you the things I know he did do.
Disabled our ads temporarily
deleted the second view entirely and went with native orientation and resizing
added this to almost every .m file.
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
As well a programmatically changed a few of the other views similar to this
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIDeviceOrientationLandscapeLeft || interfaceOrientation == UIDeviceOrientationLandscapeRight)
{
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)
{
self.Button.frame = CGRectMake(27,96,86,86);
self.Label.frame = CGRectMake(27,162,86,21);
}
else
{
self.Button.frame = CGRectMake(18,100,86,86);
self.Label.frame = CGRectMake(18,164,86,21);
}
}
}
Sorry, I can't fully explain the answer, I do not fully understand everything that was included in the project that affected the orientation. I am still very new to iOS development.

Related

how to detect the landscape mode on rotation in ios7?

My app displays pdf pages,in portrait mode a single page is getting displayed(default mode is portrait).On rotating to landcscape it should display two pages side by side,
In my ViewController's viewdidloadmethod i have added the following,
- (void)viewDidLoad
{
UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];
landscape=UIDeviceOrientationIsLandscape(deviceOrientation);
if(landscape)
{
//logic goes here
}
else
{
logic for portrait goes here
}
}
But it's not working for me,only the portrait logic is getting excecuted.Please help
Orientation changes are handled a bit different way.
Your viewcontroller needs to receive notification, when orientation changes.
Here's the sample code:
#implementation PortraitViewController
- (void)awakeFromNib
{
isShowingLandscapeView = NO;
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
}
- (void)orientationChanged:(NSNotification *)notification
{
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (UIDeviceOrientationIsLandscape(deviceOrientation) &&
!isShowingLandscapeView)
{
isShowingLandscapeView = YES;
// logic for landscape orientation goes here
}
else if (UIDeviceOrientationIsPortrait(deviceOrientation) &&
isShowingLandscapeView)
{
isShowingLandscapeView = NO;
// logic for portrait orientation goes here
}
}
For futher information, check Apple documentation

How to rotate a video embed in UIWebView (for iOS 7 only)?

The app I'm working on is portrait oriented, but when a video is running (it is embed in a webview), I need to re-orient the video in landscape mode. How should I do that? I found a solution, which worked just fine until days ago :). I believe it's because iOS 7 updates, but I'm not sure. So, this is what I previously used, but it is not working anymore because window and class name are always nil.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
id presentedViewController = [window.rootViewController presentedViewController];
NSString *className = presentedViewController ? NSStringFromClass([presentedViewController class]) : nil;
if (window && [className isEqualToString:#"MPInlineVideoFullscreenViewController"]) {
return UIInterfaceOrientationMaskAll;
} else {
return UIInterfaceOrientationMaskPortrait;
}
I found a solution by myself, finally! I implemented the following method in AppDelegate and it worked. My problem was that, at first, I didn't check the right view controller.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
NSString *className = NSStringFromClass([window class]);
if ([((UINavigationController *)window.rootViewController) respondsToSelector:#selector(visibleViewController)]) {
className = NSStringFromClass([((UINavigationController *)window.rootViewController).visibleViewController class]);
}
if ([className isEqualToString:#"MPFullscreenWindow"] || [className isEqualToString:#"MPInlineVideoFullscreenViewController"]) {
return UIInterfaceOrientationMaskAll;
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
return UIInterfaceOrientationMaskLandscape;
} else {
return UIInterfaceOrientationMaskPortrait;
}
Here's a solution that will allow rotation on any additional windows presented in the iPhone app (such as a vide player) but remain landscape in an iPad app. Place it in your app delegate.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
return UIInterfaceOrientationMaskLandscape;
} else {
if (window == self.window
|| ![window isMemberOfClass:[UIWindow class]]) {
return UIInterfaceOrientationMaskPortrait;
}
if ([window isEqual:[[UIApplication sharedApplication] windows][1]]) {
// Rotate the secondary window.
return UIInterfaceOrientationMaskAllButUpsideDown;
}
return UIInterfaceOrientationMaskPortrait;
}
So I figured I'd share what my solution was. Actually branching off of the OP question, just modified it. Works for me on iOS 7 and 8.
My approach was different as I have a toggle switch in another view controller that enables portrait or landscape.
Anyways, here it is.
UPDATED:
Ok so the previous method broke the launch screen. Example: If you have your device in landscape, and launched but it's a portrait app, it will rotate, BUT, the window will get cut in half. Pain in the butt esp if you have some nice loading screens going on. Anyways, the replaced code below fixes that AND allows video rotation. Obviously not everybody will be using a rotation switch, just adjust accordingly.
//Allow video only rotation in portrait mode.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
//Switch for Rotation
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
BOOL switchOn = [userDefaults boolForKey:#"Rotation"];
if (switchOn) {
window.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
[window setFrame:[[UIScreen mainScreen] bounds]]; //Add
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else {
id presentedViewController = [window.rootViewController presentedViewController];
NSString *className = presentedViewController ? NSStringFromClass([presentedViewController class]) : nil;
if ((window && [className isEqualToString:#"MPInlineVideoFullscreenViewController"]) ||
[className isEqualToString:#"MPMoviePlayerViewController"] ||
[className isEqualToString:#"AVFullScreenViewController"]) {
window.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
[window setFrame:[[UIScreen mainScreen] bounds]]; //Add
[window makeKeyAndVisible];
return UIInterfaceOrientationMaskAllButUpsideDown;
}
window.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
[window setFrame:[[UIScreen mainScreen] bounds]]; //Add
return UIInterfaceOrientationMaskPortrait;
}
self.window.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
[self.window setFrame:[[UIScreen mainScreen] bounds]]; //Add
[self.window makeKeyAndVisible];
}
UPDATED AGAIN:
So the previous edit I laid out had a weird flicker of the view below the movie player. This seems to have fixed that. Tested on 6+ device, and iOS 7/8 in the simulator.
Hope this helps somebody.
Swift 3, I sorted out on this way (your info.plist / project settings can have ONYL the portrait orientation checked) :
// MARK: - Orientation
extension AppDelegate {
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
// Let webView video to be rotated
if window != self.window {
return window?.rootViewController?.supportedInterfaceOrientations ?? .all;
}
// All other screens are portrait
return .portrait;
}
}
Try It....
-(BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
If you don't want your UIViewController to be able to rotate when the video isn't on the screen. Use this--
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(webView && webView.superView) return YES;
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
This is very similar to how I solved for iOS 7, but this doesn't work for iOS 8. MPFullscreenWindow is no longer returned and Xcode complains about breaking constraints.
My solution seems to be fairly general, and takes care of some weird behavior on iOS 7 where window sometimes passed in as nil.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
return UIInterfaceOrientationMaskAll;
}
else
{
// when dismissing a view controller, the view controller being returned to isn't in control of the orientiation
// (shouldAutorotate and supportedInterfaceOrientations seem to be called, but they aren't observed then,
// rather only when the device is rotated after that view is fully showing)
// instead, the result of this method only is what's observed
// we could return different values depending on which view controller is frontmost, but currently it seems
// good enough to call supportedInterfaceOrientations of the frontmost view controller and return that
// on ios7, critical calls to this method are often passed window=nil, in that case use self.window instead
UIViewController *frontViewController = window ? window.rootViewController : self.window.rootViewController;
// special case only when transitioning to or from a presented view controller
if (frontViewController.presentedViewController &&
(frontViewController.presentedViewController.isBeingDismissed || frontViewController.presentedViewController.isBeingPresented))
{
if (frontViewController.presentedViewController && !frontViewController.presentedViewController.isBeingDismissed) {
frontViewController = frontViewController.presentedViewController;
}
if ([frontViewController isKindOfClass:[UINavigationController class]]) {
frontViewController = ((UINavigationController *)frontViewController).topViewController;
}
// return whatever the front view controller's supportedInterfaceOrientations returns, since it normally is ignored for some reason
return [frontViewController supportedInterfaceOrientations];
}
else
{
// return this normally, this gets intersected with the result of the front view controller's supportedInterfaceOrientations
return UIInterfaceOrientationMaskAllButUpsideDown;
}
}
}
=> Put below method inside your AppDelegate class, it allow to play video in landscape mode even when device orientation is locked to portrait mode only:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)windowx
{
if ([[self.window.rootViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]] ||
[[self.window.rootViewController presentedViewController] isKindOfClass:NSClassFromString(#"MPInlineVideoFullscreenViewController")])
{
if ([self.window.rootViewController presentedViewController].isBeingDismissed)
{
return UIInterfaceOrientationMaskPortrait;
}
else
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
}
else
{
return UIInterfaceOrientationMaskPortrait;
}
}

Allow autorotation on just one view controller

In my project I have allowed only portrait rotation, but for one ViewController I would like to enable also landscape. I'm presenting this ViewController as ModalViewController, I've tried using methods - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation or iOS 6 methods like -(NSUInteger) supportedInterfaceOrientations but nothing actually worked. The view didn't rotate although those methods got called.
After this I've tried to rotate it by myslef with listening to those notifications :
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(didRotate:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
but even though I was able to manually rotate the view in method didRotate: it's very messy and I can't rotate the StatusBar.
I would really like to use standard methods like shouldAutorotateToInterfaceOrientation, but I don't know how. Anyone?
Add this in your app delegate.m
# pragma mark - Rotation
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if ([self.window.rootViewController isKindOfClass:[MVYSideMenuController class]]) {
// Get topmost/visible view controller
UIViewController *currentViewController = [self.window.rootViewController.childViewControllers lastObject];
// Check whether it implements a dummy methods called canRotate
if ([currentViewController respondsToSelector:#selector(canRotate)]) {
// Unlock landscape view orientations for this view controller
return UIInterfaceOrientationMaskAllButUpsideDown;
}
}
// Only allow portrait (standard behaviour)
return UIInterfaceOrientationMaskPortrait;
}
-(void)canRotate
{
}
and then add this method
-(void)canRotate
{
// just define the method, no code required here
}
in every ViewController (.m files) where you want to provide rotation. You can also include here -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation method to react when the device rotates:
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
switch (orientation) {
case 1:
case 2:
//NSLog(#"portrait");
break;
case 3:
case 4:
//NSLog(#"landscape");
break;
default:
//NSLog(#"other");
break;
}
}
Subclass a navigation controller for your screen that requires rotation.
In the .m
// Older versions of iOS (deprecated) if supporting iOS < 5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
// iOS6
- (BOOL)shouldAutorotate {
return YES;
}
// iOS6
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
This overrides the rotation methods set in the summary page for iOS 6.
In iOS 6 the view controllers only look to there parent or root controller for rotation methods
can't you just call the shouldAutoRotateToInterfaceOrientation in the viewDidLoad and viewWillAppear like so:
[self shouldAutorotateToInterfaceOrientation];
that should call the method if its in your ViewController
Implement is in all controller and Return on that interfaceOrientation which you need for a specific controller
For All
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation{
return YES;
}
For Landscape
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
For Portrait
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown));
}

iPad app with multiple views, how do I make ONE single view viewable in landscape only?

After a supportive answer of miamk, I am a step closer to achieving what I want.. But there's the following issue now:
I have an iPad application that can be used in all four view modes (portrait up/down and landscape left/right). But at a certain point I have a View that I only want to be seen in landscape mode. So I do the following in the UIViewController that will trigger the action to view the landscape-only view:
- (void) showProperty:(Property *) property {
if ([self interfaceOrientation] == UIInterfaceOrientationLandscapeLeft || [self interfaceOrientation] == UIInterfaceOrientationLandscapeRight) {
PropertyViewController *propertyView = [[PropertyViewController alloc] initWithNibName:#"PropertyViewController" bundle:[NSBundle mainBundle]];
propertyView.property = property;
[self.navigationController pushViewController:propertyView animated:YES];
[propertyView release];
propertyView = nil;
}
else {
RotateDeviceViewController *rotateView = [[RotateDeviceViewController alloc] initWithNibName:#"TabRotate" bundle: [NSBundle mainBundle]];
rotateView.property = property;
[self.navigationController pushViewController:rotateView animated:YES];
[rotateView release];
rotateView = nil;
}
}
This works fine and thus shows either the desired screen (PropertyViewController) when the iPad is held in landscape mode, and if not it shows the RotateDeviceViewController which shows the user a message that he/she is supposed to rotate the device to correctly view the screen.
So that works!
Then the problem arises in this RotateDeviceViewController.. There I have the following:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UIInterfaceOrientationIsLandscape(interfaceOrientation))
[self showProperty];
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
- (void) showProperty {
PropertyViewController *propertyView = [[PropertyViewController alloc] initWithNibName:#"PropertyViewController" bundle:[NSBundle mainBundle]];
propertyView.property = property;
[self.navigationController pushViewController:propertyView animated:YES];
[propertyView release];
}
So as soon as I rotate the device (when viewing the RotateDeviceViewController) to landscape mode I show the user the PropertyViewController. This works... But when the PropertyViewController appears it shows my layout 90 degrees rotated. So basically it shows the content in portrait mode instead of using the landscape mode (which is actually the way you are holding the device)..
I hope this makes sense and someone can show me what's causing this.
A more elegant workaround (at least in terms of design) to #MacN00b's answer, is to set up a portrait view with a message that tells the user that he should rotate the device and only when he rotates it you show the view built for landscape.
Honestly, I think its ugly to have everything already rotated when the user is still in portrait orientation.
You can listen for orientation changes using:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(orientationChanged:) name:#"UIDeviceOrientationDidChangeNotification" object:nil];
And then respond to those by loading the appropriate view...
- (void) orientationChanged:(id)object
{
UIInterfaceOrientation interfaceOrientation = [[object object] orientation];
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
self.view = self.portraitView;
}
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
self.view = self.landscapeView;
}
}
If this is going into a dedicate UIView subclass for the screen in question you can make the portraitView contain a label notifying the user to rotate the screen to view the content and then make the landscape view contain your actual content.
I currently do this in an app and both views are contained in a single nib. Just be sure you set the orientation on the view properties in IB appropriately for each view...
Try this:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Hope this helps.

Landscape Mode: Flip image when you flip your iPad

Apple demonstrated Photo's for the iPad. In their demo, they said you can Flip the iPad and it flips the image.
How is this result achieved?
I've been reading about UIInterfaceOrientation all day and I'm lost
Any help would be appreciated.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
// NSLog(#"orientation: %#", [orientation )
if(orientation==UIInterfaceOrientationPortrait ||orientation==UIInterfaceOrientationPortraitUpsideDown) {
//Code
return NO;
}
if (orientation==UIInterfaceOrientationLandscapeRight ||orientation==UIInterfaceOrientationLandscapeLeft ) {
//Code
return YES;
}
return NO;
}
You implement in your UIViewController subclass:
- (BOOL)shouldAutorotateToDeviceOrientation:... {
Return YES;
}
And most of the time the UIKit manages it all for you.