I have tab bar application and I have a problem with the rotation. I am using a storyboard with the tab bar controller as a initial view controller and on ios 6 everything works and views rotate to landscape and portrait, but on ios 5 views are only in portrait mode and rotation does not working.
I tried to create custom tab bar controller subclass and I added shouldAutoRotateToInterfaceOrientation function to it, and also to all view controllers in the tab bar but it didn't help.
Has someone any idea what can be wrong?
Edit:
If you have Xcode 4.5.2 you can create new project from tab bar application template and check yourself whether you have the same problem.
Check that this is in EVERY view controller in your app
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
But don't worry about subclassing the tab bar controller, you shouldn't need to do that.
I found that post and that solution works for me:
http://iosgems.blogspot.de/2012/11/how-to-get-autorotation-working-for.html
Related
Since I updated to Xcode 9.2, the tab bar isn't displayed anymore in one of my child views and I'm struggling to get it back.
I did everything using the storyboard.
Here is a screenshot of it:
As you can see, the same segue is used in both views but the result is not the same...
I ended up using a small workaround. Maybe it is the right way to do it and my first implementation was wrong.
So instead of embedding the tab bar controller in a nav bar controller I ended up putting each tab in a nav bar controller.
Like this:
screenshot
And now everything is working correctly.
In xcode 8 we could simulate translucent navigation bar of a view controller. Is there a way to do the same thing in xcode 9?
I did the same thing as in xcode 8:screenshot, yet nothing happens.
How could we manipulate navigation bar items if there is no navigation bar simulation?
Thanks.
Not sure if this is a bug that is going away in later releases but temporarily I just made controller root view controller of navigation controller. The navigation controller never gets instantiated or segued to from anywhere but it's enough to get storyboard to look correct.
I am having some trouble hiding toolbar (Bottom bar) on one of the view controllers in my iOS app. So I have a home view controller which has a navigation bar and a toolbar. Then a UIPageViewController is pushed (a tutorial for the app). There should be no navigation or toolbar on this screen.
I used the standard code to hide the toolbar. Here it is:
self.navigationController.toolbarHidden = YES;
It works in iOS 8 but not in iOS 7. I tried many variations and tried putting it in viewDidLayoutSubviews, viewWillAppear, viewDidappear and also right before pushing the view controller. Nothing works. Hiding navigation bar worked without issues.
Any help is much appreciated.
A better property to use when you want the toolbar hidden when pushing is setting hidesBottomBarWhenPushed to YES on the UIViewController you are pushing.
I have encountered a strange behaviour when using the tab bar controller in iOS. I have such a controller with 3 tabs, as can be seen on the following image:
The following problem only occurs on a physical device, not on the simulator: When I present a view controller (modal) on top and dismiss it again, the tab bar turns fully transparent (not translucent) if and only if it was presented while the map tab was active. If the list or settings tab is active when the view controller is presented, then everything stays as it's supposed to be after dismissing that view controller again.
Has anybody encountered a similar behaviour? Is it a bug? Or am I doing something wrong?
Thank you for your help.
Is this only on iPhone 4? I have had a similar bug only on 4s. There is a fix for it if that is the issue. It's an apple bug. Try in viewDidAppear in the tab controller.
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
//Stupid fix for iPhone 4 Tab bar background becoming invisible
self.tabBar.translucent = NO;
self.tabBar.translucent = YES;
}
This worked for me to fix the background disappearing on a translucent tab bar when on iPhone 4
I have an app built in storyboard that needs to support landscape mode in just one view controller. I decided to support iOS 6 after some issues with supporting iOS 5 and running iOS 6 on my phone. I used this Stack Overflow answer: https://stackoverflow.com/a/12505461/1050388 but I'm still seeing a weird quirk. (For those interested, my controller scheme is Tab Controller -> Navigation Controller -> TableViewController -> UIWebView. The UIWebView is the only VC I need to rotate.)
I blocked all but one VC from turning, but that VC is in the "More" tab. I initially had a quirk where this "More" VC would change orientation to landscape when rotated and then any subsequent VC would be in landscape, but I found this (https://stackoverflow.com/a/12526152/1050388) and creating a category for UINavigationController helped to solve that issue.
However, when I navigate to that tab in the "More" list, and turn the VC, it doesn't rotate. But when I click "Edit" and move that tab to the home row of the initial 4 tabs, it rotates just fine. If I move it back, it doesn't rotate. Anyone have an idea why this is happening?
I believe the problem stems from the fact that the More navigation controller is generated dynamically by iOS and is read-only.
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITabBarController_Class/Reference/Reference.html#//apple_ref/occ/instp/UITabBarController/moreNavigationController
It would be great if the technique of using a custom category would work here but based on your experience I guess it doesn't.
I also need better control of orientations for More tab views. Please post anything you come up with. Thanks.