I have a navigation controller inside a tab bar controller. When In landscape mode, the back button animation pushes down, rather than to the right.
What do I need to do to make it push right like it does in portrait mode? Thanks.
I have seen this happen before if one of your UIViewController's does not have landscape support.
Double check your shouldAutorotateToInterfaceOrientation in both of your UIViewControllers and make sure they both return YES for both portrait and landscape.
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 have a viewController (mainView) that supports every orientation on iPhone.
From this view, another viewController is presented with modal style, which only supports only Portrait orientation (and forces the orientation accordingly).
Usually, the topLayoutGuide is at y=20px and the layout of the toolbar right below is attached to that topLayoutGuide
Now i have the following sequence of events
display mainView in portrait orientation
open modal view in portrait orientation
turn to landscape orientation (modal view obviously stays in portrait orientation)
dismiss modal view and return to mainView
After this, the topLayoutGuide is suddenly at y=0px and therefore, the toolbar is positioned over the statusbar, and also keeps that value after rotation in the mainView.
Does anyone know how to update (or force) the topLayoutGuide back to 20px?
You can either adjust insets manually, or you can force the SDK to force to "refresh the orientation" of your controller.
I am adding a simple button into a view on a tabbarcontroller to the bottom right of the view. This button is clickable only when it is on portrait, not when the app is flipped to landscape. The app is using autolayout, so I've added two constraints so it hugs the bottom right of the view on landscape and portrait. Horizontal space at 20 and Vertical space at 24. I've tried this on a UIViewController without the UITabBarController, and it works perfectly. But once the view is added to a tab, it stops working. How do I get this button clickable on both portrait and landscape?
This seems like a very simple setup, but I have no idea why this does not work.
![snapshot2]http://ownits-stackoverflow.s3.amazonaws.com/snapshot2.png
![snapshot3]http://ownits-stackoverflow.s3.amazonaws.com/snapshot3.png
I tried the same thing it works. Here is the sample code try to run it on your own simulator and on device.
Sample Project
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.
In my app I have a navigation back button which occupies the top left of the navigation bar as such. Now I have a requirement to make the view in the navigation stack a split view. I'm doing my own custom split view controller. Now the question arises in the portrait mode of this split view. I want it to have the default popover behavior in portrait mode (like Apple's splitview in portrait). Can I manually set the location for the popover button on the navigation bar to some place other than top left without violating any UI guidelines? Since the back button is on top left corner by default already. I read over the UI guidelines but could not find anything concrete relating to this issue. Can the popover button be placed anywhere on the navigation bar for the portrait mode of my custom split view?
Thanks!
Yes, it can be done. As you said, there is no strict rule over placement of the pop-over in portrait mode.
This app uses custom split view and the placement of the button to display the navigator (inside a popover) in portrait mode varies on what view controller it is currently displaying. Whether it is the root of the navigation or if it is the view controller pushed over the navigation controller.