ipad 3.2.2 loading in landscape - iphone

I changed the properties in info.plist to support orientation in landscape thereby the app opens in landscape mode as well. The problem which i face is like when the app loads in landscape mode the view is properly aligned. There is a view on the right side of the split view is not aligned properly. But when i load that in the portrait mode and then into landscape there are no issue. Can you tell me if there are additional properties or some work around for this issue.

as you are using splitview controller you should not worry about orientation.
just see in your view .nib file there is one authosizing feature set that properly u will remove this problem.
This link may help you if you dont know about autosizing.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
add this code...hope it will work...

Related

Image orientation distorts to the wrong orientation on startup (iOS)

I have an app, haven't modified it since 6 months ago, anyway I decided to open it up in the simulator. But the first viewcontroller which shows after the splash screen is scrunched up and is showing through the wrong orientation. It's showing in portrait when it should be showing in landscape.
This is the code for it:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
However,
When I tap to go to another view, then go back to the main viewcontroller, the problem fixes itself and the orientation is correct.
So it only happens on the initial launch after the splash screen is shown.
Please join the links together to view the screenshots as i cannot post images as i haven't got 10 reps yet.
This will make sure the app to open in landscape mode .
In the AppDelegate you may be using this
[self.window addSubView:viewControllerObj]
The problem was with the above line. Orientation will work properly with the above line in iOS 5 but in iOS 6, for orientation to work properly, change the above line with
[self.window setRootViewController:viewControllerObj]
Then the app rotates when orientation changes
Open your plist file ->addRow-> add "Initial interface orientation" and give value Landscape (left home button).
Hope this will help you.

Portrait within Landscape

I am using the interface builder in Xcode 4. I have created a 480(w)x320(h) image to use in landscape mode for my app. WIthin IB I set the view's orientation to "landscape". I place my image on the view. I have set the "supported device orientation" to landscape letf/right. I have changed the info.plist to support landscape orientations.
Here's the weird part: When I run the app, the simulator does rotate/start in landscape, however, my image has somehow rotated 90 degrees as well so it appears cropped and and only takes up about 1/3 of the screen.
So to simplify the explanation, the image always appears in the opposite rotation of the view. I have tried removiong the .png file and re-adding and performing a "clean" with no luck. ANy advice?
you shoukd to modify your shouldAutorotateToInterfaceOrientation metho in all your viewControllers, that should be in landscape:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
return YES;
}
}

How to change already developed app into both orientations Landscape and portrait?

I developed app(navigation + tabbar) in portrait mode.
But now I want that if user change its orientation to landscape or
portrait then all should be rotate in that orientation.
You need to set each view's control autoresizingmask. You can do it through xib as well as code as per your need and add below method in all viewControllers and it should work.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
return YES;
}
Hope this help.
And have a look into your ".plist", you can define "Supported interface orientations" (UISupportedInterfaceOrientations) here.

Forcing rotation to landscape

I would like my app's rotation to be fixed as landscape...
I've done some research, but most posts are about detecting change,
and I couldn't find any about forcing one.
Could anyone help me?
Try this
In plist change the Supported interface orientations to Lansdscape
OR
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); // home button on right
}
All the best
You can change the info.plist of your project so that you app always shows Landscape initially.And then you can make your view controller's to support only landscape orientation.
hope this also helps
Only support for landscape Interface orientation
Launching application in landscape orientation for IPad

iPad landscape modal view incorrectly sized

I have a iphone app where I want to present one of the views modally in landscape mode only and have set the code below its view controller. All works fine on the iphone (its intended platform), but when run on the iPad for demonstration, the left hand edge of the landscape view is truncated by approx 10 pixels. i.e. it looks like the display is too wide for the screen. No other views are affected and the same thing happens at 1x or 2x zoom.
Is this a bug or have I missed something?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
InterfaceOrientation can return "unknown" value, in these cases you can encounter the case that the iPad thinks it is rotated and your code will return the wrong result