iOS - tab bar turns transparent after dismissing view controller - ios

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

Related

NavBar overlaps Status Bar in iOS 13 Swift

In some devices as iPhone 7 and 8 the navigation bar overlaps status bar after do navigating, the parent view controller has status bar hidden but I show and hide it in viewWillAppear and viewWillDisappear respectively. I tested in iOS 12 and it works.
I am using prefersStatusBarHidden to hidden the status bar.
Here the Image
Navbar Overlaps Status bar
Update:
Here an example project: https://github.com/FranklinSamboni/NavBarTestSwfit.
It work fine in iOS 12 but with iOS 13 the navigation bar overlaps status bar in iPhone 7,8
Images with iPhone 8 (simulator)
Home
The second view
Second View
Okay, I'm going to give one of those wishy-washy answers.
On the one hand, you've definitely found a new behavior in iOS 13. When you hide the status bar, the navigation bar shrinks. You could term this a bug in iOS 13...
On the other hand, it could be argued that what you are doing is wrong. If you have a navigation bar, you already cannot hide the status bar on a device without a bezel (iPhone X etc.), and now Apple seems to be assuming that if you have a navigation bar you won't hide the status bar at all. And that is a reasonable assumption, because it makes no sense to hide the status bar in portrait when there is a navigation bar, and especially in some children of the navigation controller but not others.
So you could file a bug report on this, but I don't think you'll get any joy from it. Apple is likely to reply that this is intended, or is at least a consequence of doing something they don't want to support. You have a navigation bar; allow the status bar to show.
I faced the same problem, after a few hours research, I found a not perfect but worked solution. Hope it will work for you.The code was written with Objective-C.
In viewDidAppear method of the secondViewController, hide statusBar first and show it at once.
Declare a member variable BOOL statusBarHidden in secondViewController
Implement prefersStatusBarHidden method from UIViewController
- (BOOL)prefersStatusBarHidden
{
return statusBarHidden;
}
Create a new method setStatusBarHidden
- (void)setStatusBarHidden:(BOOL)hidden
{
if (statusBarHidden != hidden)
{
statusBarHidden = hidden;
[self setNeedsStatusBarAppearanceUpdate];
}
}
Call setStatusBarHidden in viewDidAppear
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self setStatusBarHidden:YES];
[self setStatusBarHidden:NO];
}

How to get rid of the glitch that occurs right after pressing the back button?

A strange glitch happens when I press the back button.
The glitch happens during the transition from the actual View Controller to
the previous view controller.
A portion of another view controller appears for a brief moment between the
search bar and the first cell, and then it disappear.
(The black rectangle in the screen shots)
here are some screen shots and a link to a side project where I recreated
the problem.
Link to the project : https://www.dropbox.com/sh/ak5mckhrysychlr/AACQd2Mwh5RxklmD1dv738h1a?dl=0
you are using opaque navigation bar in some view controllers and translucent in some,that's y it's causing the issue,Change the navigation controller to Translucent
Change your UINavigationController to Translucent and this issue will be fixed.
self.navigationController.navigationBar.translucent = YES;

Toolbar issues with iOS 7/8

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.

iOS 7 - Presenting modal view controller selects first tab in UITabBarController

I'm working on a UITabBarController-based application for iOS with Xamarin, and while making some relatively small changes for iOS 7.0 compatibility, I found a particularly annoying issue that I am unable to solve.
A number of the view controllers that make up the UITabBarController have areas that require another view controller to be presented modally, sliding up from the bottom of the screen. In iOS 6.1, everything works fine.
However, in iOS 7 I've noticed that when the presented view controller is dismissed, the UITabBarController underneath has been navigated back to the first (leftmost) tab. This is very problematic, since any progress or information entered is lost.
Has anybody experienced this issue or, hopefully, found a solution?
Embarrassingly, I found out the cause of the problem. In order to fix this issue: UITabBar appearance setSelectionIndicatorImage does not work on first launch iOS7
I had this code running in my UITabBarController's ViewWillAppear overridden method:
if ( Session.IsiOS7 )
{
this.SelectedIndex = 1;
this.SelectedIndex = 0;
}
This is being used to force the tab bar to display the selection indicator image, which it does not do by default in iOS 7. It also happens to cause this problem! I can't believe I didn't think of this right away.

iOS 5 autorotation not working

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

Resources