Frustrated by how simple this should be...
I'm trying to add landscape support to an existing iPad app of mine. Do I actually have to create a completely new view controller for landscape mode? (surely not as that is a complete pain!)? Or can I use the existing view controllers and design for landscape and portrait? The simulated metrics thing doesn't work because whenever I make changes in a view controller in landscape mode and switch back to portrait it messes everything up! I know how to switch the view to landscape programmatically, this is (at least i think) an 'interface builder' sort of issue.
Why is this so difficult to do/hard to find!? Might be worth mentioning I'm using Xcode 4.2 with storyboards rather than separate xibs. Surely I don't have to use a separate view and segues because I really can't be bothered wasting my time with that.
Any help would be nice! Thanks
Watch for -willRotateToInterfaceOrientation:duration: and change the frame of your interface elements when the rotation changes.
Related
I want to make a design that works on both portrait and landscape. I am doing my design in storyboard. Say, for signup view controller the design is working on portrait mode. But I can't make the design in landscape. I googled for couple of hours, but I can't get any tutorial from where I can move ahead.
Can any one please help me?
Use autolayouts for that. Here are some tutorials:
http://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2
http://www.raywenderlich.com/115444/auto-layout-tutorial-in-ios-9-part-2-constraints
Please note, for working your app in both orientations, enable portrait and landscape modes in General Settings->Device Orientation.
I'm developing an app targeting iOS 7 and above. I'm using storyboard and autolayout, and I have to show different layouts of each storyboard scene depending on the device orientation, I mean, for example: in portrait I may have a button at a certain place that has to be shown in another place in landscape, or I may have controls in portrait that should disappear in landscape and have to rearrange the rest of controls.
My question is: when there are a lot of differences between portrait and landscape, should it be better to manage all this changes by programmatically updating constraints, or should it be better to create different nib files and load the corresponding according to the orientation?
use size classes their will be no problem in giving support to ios7 . I have tested their were no major problems in ios7 while using size classes.
I'm struggling a bit with the new UISplitViewController in iOS 8.
I want to achieve a slideout-style menu on iPhone (landscape and portrait) as well as on iPad in portrait orientation and a persistent sidebar on iPad in landscape orientation.
I got a UITableViewController as the master and a UINavigationController with a couple of UIViewControllers as the detail in my SplitViewController.
Is it possible to to get something like this with the new UISplitViewController in iOS 8?
First it would be enough the get the iphone sliding thing to run :D
Thank you :)
The UISplitViewController will do just that. Sliding menus and everything.
It works like a dream if you use it exactly by the book. And this requires setup of some UINavigationControllers as part of the magic.
Tutorial is highly recommended for the first time. It's easy to get it messed up quickly otherwise. :)
http://nshipster.com/uisplitviewcontroller/
By default, the UISplitViewController in iOS8 will only act as a slideout-style menu on the iPad (in both portrait and landscape mode) and iPhone 6+ (in landscape mode only).
As to whether or not it is possible to get the slideout-style menu working on all iphones via the splitViewController, I don't actually know (I'm still new to iOS development). I suspect that it entails modifying how the splitViewController treats different size classes. If there isn't an easy way to change the splitViewController's behavior, perhaps you could subclass the splitViewController and override the functionality that you do not like.
I have not tried this before, nor do I actually know how the controller determines how it is displayed in different size classes. However, if I were trying to accomplish what you are, then this is what I would be looking up.
I am having a weird problem with keeping orientation on the iPad. Very rarely, when I swap in and out view controllers, my view is displayed as portrait, even though my device is in landscape mode.
What should I do to resolve this problem? I have already set my controllers to landscape using shouldAutorotateToInterfaceOrientation: method. Also, it appears only very rarely, making tracking the bug very difficult.
Is there a faster way to find out why the orientation is wrong, besides going through each controller?
I see your comment that you are managing orientation by code using "shouldAutorotateToInterfaceOrientation", that is specifically an iOS5 method. By any chance is the iPad iOS6? If it is, you need to back it up with "supportedInterfaceOrientations".
Building an application which started as fairly simple, but now got pretty complicated. I am facing a strange problem. I am now using only storyboards to define all of my views. The problem I am facing is, some view-controllers in storyboard are appearing in Landscape mode and others in Portrait mode.
I know it won't make a difference in final application, but it is making it hard for me to design and visualize things. Has someone else faced this problem?
Click on the view in storyboards , click on the attributes inspector (third from the top left) in simulated metrics change the orientation to portrait