root UIViewController orientation landscape, touches weird in subviews - iphone

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.

Related

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