Portrait within Landscape - iphone

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;
}
}

Related

Universal project: how to make landscape start-up in iPhone and portrait in iPad

I have an universal project, and want to keep landscape from very beginning of star-up for iPhone and portrait for Pad. How can I do it?
That's not possible. iPhone apps always have to start in Portrait orientation. Any game you see that has landscape-only display is still starting showing a portrait default image and the root view controller then can be landscape-only.
On iPad you can restrict the app orientation to Landscape and also have it start in Landscape.
The iPhone restriction is enforced by Apple and they won't approve an iPhone app that restricts itself to Landscape start.
If the device is already in landscape position it will start as landscape, but if you want your program to work always in landscape position and never flip to portrait, you have to set the orientation to landscape in each class you create:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscape || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}

ipad 3.2.2 loading in landscape

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...

screen orientation like portrait and landscape in iphone

Im new to iphone development. here i want to view the screen like landscape porgrammaticaly in iphone. i completed like portrait side now when i turn left and right sides automaticaly i added some images and pickerview data these are also shown like portrait and landscape screens to iphone .
Can any one plz help me for how to orientation the screen programmaticaly in iphone
thank you in advance.
Use this method in your class.
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

root UIViewController orientation landscape, touches weird in subviews

I'm making an application which will be landscape only. Therefore, my root UIViewController is set to be landscape (all xib files I have are landscape orientation).
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
When I try to touch a button in one of the subviews, it does not receive a touch. If I remove the override shown above, the buttons get the touches, but the subview is shown in portrait orientation.
How should I work around this problem?
Thanks & Best Regards,
David
Aside from that, you have to set the supported orientations in your info.plist file.
Its under "Supported interface orientations", with key "UISupportedInterfaceOrientations". Remove the portrait orientations in the list.

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