Hi I have to develop a Cocoa app for OSX with both orientations (landscape and portrait). My first idea is when the app finish launch to check the screen resolution to see if it is portrait or landscape and then show the landscape view or the portrait view. The views have the same elements, the only difference is the position of them. How do you think is the best way of accomplish this? Two views with two controllers? one controller with two views? Any advise would be appreciated
Thanks
Related
I want to initially launch one of the View controllers in JUST landscape mode, while the other views and the whole app can work in both portrait and landscape. How can I do it in iOS 7? Thank you.
So your whole app may supports all orientations but one view controller needs to be landscape only.
You can easily stop your landscape view controller to rotate from landscape to portrait but when the app is in portrait already then it is difficult to force the deivce to rotate as this contradicts the iPhone manufacturers priciple.
In fact, it is not really difficult when you know the trick. See my answer to this similar question.
Force controllers to Change their orientation in Either Portrait or Landscape
I am developing an iOS app in landscape mode, except that I need the tab bar to be on the right side(vertically). I was wondering if I could display all the viewControllers(navigation driven app) in landscape mode and only the tabbarController in portrait mode?
In other words, can I set the orientation of all viewControllers to landscape mode and set orientation of only the TabBarController to landscape mode so that I can affectively make it appear on the right side?
Any pointers are greatly appreciated.
Thanks much!
This is probably not the answer you are looking for, but I would highly recommend to open the UITabBarController & UITabBar headers to get an idea on how a tabbar is implemented, and start creating/subclassing your own, instead of hacking the existing components together. You'll need at least a viewcontroller, an array to retain the viewcontrollers represented by tabs, a view to display the active viewcontrollers view and a pointer to the active viewcontroller.
The learning curve for writing your own viewcontrollers is much higher, but trust me, it is worth it.
I have encountered a problem developing an iPad app with xCode.
When I load a view into my rootViewController like this
[self setView:viewController.view];
The view is always displayed in Portrait even though the device is rotated to landscape.
I checked all options and tried changing the shouldAutoRotateToOrientation method and it seems to have nothing to do with it.
If I rotate the device to portrait and then back to landscape it works.
Does anybody know why this is happening?
Best regards,
Matteo
The problem was that I was nesting viewControllers which leads to bad behavior like rotation notifications not being sent to certain ViewControllers.
I have question regarding changing orientation on iPad.
I use MonoTouch, but if Obj-C programmers can help, it will be just as great.
First of all, I figured out if I provide different splash screen images for different orientations, app will show the right one. This can be done for any orientation, such as "Default-LandscapeLeft.png", or generic one "Default-Landscape.png".
All of my images are of correct dimensions and yet, when I start it in portrait mode, it shows it enlarged. All of other modes work perfectly well.
Second problem is I want my app to continue to be in that orientation after my first controller appear. At the moment, it shows portrait in any case. I started generating orientation notifications before first controller appeared (UINavigationController), but I think it responds only on orientation changes. After I moved device, it rotates and from that moment, everything works fine. BUT, I want to "inherit" orientation info from my splash screen.
Any idea will be appreciated.
Thanks guys and girls.
Cheers
Images for different orientations:
Default.png and Default-Landscape.png should be provided + setting the app settings to provide the required orientations.
Second problem:
After creating the first controller call
myController.WillRotate(UIApplication.SharedApplication.StatusBarOrientation, 0);
I'm programming an iPad application and I just wrote the rotate methods and there are some buttons. I used CGRectMake method and re-positioned buttons ... portrait and landscape modes all works fine but my problem is buttons are not re-positioned when I turn my ipad upside down. Need Help
UIDeviceOrientationPortraitUpsidedown is the solution