I have installed my existing application in ios11 using xcode8 the navigation bar icons are displaying as expected when app is run using xcode9 the navigation bar icons are not showing but click actions are working fine. any icons in Navigation bar are missing while navigating from one controller to another controller.
If the navigation icons are not showing, but the interaction is still exists and works properly, it seems, that the problem is with image of the BarButtonItem. You can do next:
1) Try to set a system icon for BarButtonItem
2) Look at assets and fill all three resolutions (1, #2x, #3x)
3) Check the color of BarButtonItem
4) Check View Hierarchy
This issue happened to me and it was related to the ViewController segue properties. The segue kind was set to "Show Detail(e.g. Replace)" and changing it to Show(e.g. Push) did the trick. This is very weird because it used to work well on previous versions of Xcode but not on Xcode 9.3
Hope that helps!
Main Story board pics:
change the "kind" attribute from this:
to this:
Related
Recently, I have been trying to add a tab bar to an existing project. However, no matter what I do, the text is being cut off. I am simply trying to drag a Tab Bar Controller into the storyboard and setting it as the initial controller.
This seems to only be an issue in this project, as doing the exact same thing in a test project works fine.
Glitched tab bar
Glitched tab bar setup in storyboard
Normal tab bar in test project
Normal tab bar setup in storyboard
I am running Xcode v10.3, and the project is already on the App Store. There is no code attached to the VCs, and as far as I am aware, this should not happen.
What are some possible causes or fixes for this?
Turns out a cocoapod, AMXFontAutoScale, was to blame. I guess it scales the text of tab bars also.
I have an app that uses TabBar based navigation inside a storyboard to navigate to different views.
The app worked fine from iOS7 - iOS9. But with iOS10 the tab item disappears when it gets selected (icon and title).
The tab bar is completely configured in the story board, no custom user code. In XCode everything looks fine:
But when the app is run on a iOS10 device/simulator the app looks like the following (the image shows different selections in the same tabbar, the behavior is the same for all 3 items)
What could be the cause for this issue? Are there any work arounds?
I finally found a solution to this issue. I am still not sure if this is due to a change or a bug in iOS 10.
Taken from this reply to an old question:
https://stackoverflow.com/a/39884669/1567923
You need to create a custom TabBarViewController and use it in your storyboard.
And in that view controller do something like that, to set the tintColor in code directly:
class UIMeeetTabBarController: UITabBarController, UITabBarControllerDelegate{
override func viewDidLoad() {
super.viewDidLoad()
self.tabBar.tintColor = Style.colorRed
}
I hope this will work for you too.
Select your tabbar from tabbarController scene and set some tintColor under the view and then check if it works!
You don't need to set up a custom tab-bar controller. The problem here is missing documentation (for which I filed a bug report with Apple and encourage you to do the same).
You can fix this in Interface Builder by selecting the tab bar itself and then going to the "Tab Bar" (top) section of the Attributes inspector and setting the "Image Tint" color. I presume that when a tab-bar item enters the "selected" state, the control inverts the alpha channel of the graphic and lets the color of the underlying tab bar show through. If that color is "clear" or matches your tab-bar item's background exactly... you see nothing. If you have a dark background, try setting this value to white.
The graphic for tab-bar items is displayed using only its alpha (non-transparent) pixels as a black-&-white image. These pixels will then allow the "tint" of the underlying tab bar to show through or not, depending on the unselected/selected state.
I know this is an old one, but I faced the same issue in Xcode 9, and finally solved it without a single line of code. Go to the Attributes Inspector and make the Tab Bar Item Selected Image match the Bar Item Image...
What I'm doing:
Using a 'launch storyboard'. It's quite simple, and contains a default UITabBarController. I've set the tab bar's 'tintColor' to red in the launch storyboard, as well as in my app. I'm using Xcode 7, iOS 9.
What doesn't work:
The launch screen loads the tab bar using the default blue iOS tint color...! Then after loading, the tint color switches to red when the launch screen storyboard is replaced.
How on earth are you meant to set a tab bar's tint color in a storyboard?
Demo Project: http://s000.tinyupload.com/?file_id=73998115878034693063
The right way to go is to confuse Xcode. Xcode should not know that the launch storyboard that is used is actually a launch storyboard. This way you would be able to set some custom User Defined Runtime Attributes. However, you still would NOT be able to run some custom code...
So... To do this, follow these steps:
Create a new Xcode project
Copy your Main.storyboard into desktop and rename it to CustomLaunchScreen.storyboard.
Add this CustomLaunchScreen.storyboard to the project.
Open your Info.plist file and change key Launch screen interface file base name value from LaunchScreen to CustomLaunchScreen.
Open your CustomLaunchScreen.storyboard. Delete the default UIViewController and set the UITabBarController as your initial view controller.
Open the tabBar property of your UITabBarController and navigate to User Defined Runtime Attributes
Add the tintColor property, set type as Color and set some custom value.
You can also watch a full video tutorial Here
Well thanks to #OIDor for his solution, it is a great hack.
To be clear however, you don't need to do all that. All you have to do is:
Edit the source of your Launch Screen storyboard and change
launchScreen="YES" to launchScreen="NO", this enables you to do the
next part...
Add the user-defined attribute tintColor on the Tab Bar
in the storyboard. This is not permitted by Xcode without the first
step
Hey presto it's all working.
I think I've figured this out.
There are quite a few blog posts online about how Launch Storyboards work, but not a lot from Apple. I found from this blog post which discussed that the launch screen images are captured at runtime from the launch storyboard. Digging into my simulator directory revealed that they were in fact there:
I'm not sure why, but the call to set the UITabBar's tintColor does not fire in time when the launch storyboard has loaded, but setting colors for other values such as the barTintColor property works:
All I can say is this: setting the tintColor on a UITabBar on a view controller in a launch storyboard is not supported. There is something going on behind-the-scenes when the launch storyboard is loaded preventing this from working.
TL;DR: you can't do this with a Launch Storyboard. For a workaround that tricks Xcode into treating your launch storyboard as a regular storyboard, see OlDor's answer.
As an alternative, you could take a screenshot of your app with the tab bar loaded properly, tweak it, and use that in a UIImageView on your launch view controller.
If you want to add just the tab bar without any currently selected tabs, add a UITabBar to your launch UIViewController and style the UITabBarItems to your liking:
This UITabBar has two UITabBarItems which can be styled without adding outlets to their view controllers.
I'm using a storyboard as my launch screen in my app, it contains a UITabBarController with 5 UINavigationControllers. The storyboard doesn't do anything but provide launch screens.
What I want to do is change the default selected tab. I'm currently stuck with this:
And once the actual view controllers load I get this:
As you can imagine it's a bit jarring to have the selection jump like it does. I don't know how to change the tab programmatically since I cannot attach a custom class to anything in a launch screen. Of course, I don't really care if I do it for real, if there's a way to fake it with icons of different colors, that's fine as well, but the system adds that tint to selected icon.
Is there a way to do this with a storyboard launch screen? Thanks.
Don't use a tab bar controller in your LaunchScreen.storyboard. Instead use a normal view controller and add a tab bar, then add tab bar items as required. That seems to be the only way to make a tab bar without any index selected.
Though this question was asked years ago, I've wrangled with it quite a bit and figured out a workaround that I'm satisfied with for my app TimeFinder.
The other answers here have made some good suggestions, but trying to build a replica of TabBarController sounds challenging and unsustainable, and I didn't have much luck with the User Defined Attributes hack mentioned by Akshay Agrawal 1.
Since the problem is ultimately that the wrong item is shown as selected in the launch screen, I decided to hide the selection entirely by changing the selected image tint color to light gray to match the color of the other unselected tab bar item icons 2.
This allowed me to copy and paste my project's top-level view controllers (view controllers embedded in navbarcontrollers embedded in a tabbarcontroller) into the Launch Screen storyboard, delete all the inessential connections and view controllers, and end up with a quality launch screen that makes the app appear to load faster than it does.
Here's my Launch Screen storyboard for reference 3, and here is my app which will have this launch screen update shortly 4.
TimeFinder on the App Store
Use this piece of code in your view will appear method.
yourTabBarController.selectedViewController=[yourTabBarController.viewControllers objectAtIndex:2]
I have a UITabViewController inside a UINavigationController. As you can see on the image bellow the tab icons are set to system default "favorite" and "download" icons and they show properly when where looking in the storyboard.
One of the tabs has a collection view and the other has a web view with a status bar.
The problem is that when I deploy the app (to the simulator or a real device), the first time it opens the tab bar icon from the tab which is unselected doesn't show.
After i close and reopen the app the icon shows fine. The same thing happens if I select the tab.
How can I make the image appear correctly the first open after installation? What am I doing wrong?
I'm using Xcode 6 with iOS 8.2
Thank you
This is due to the selected image of the particular Tab bar item of the view controller just delete that selected image and give them programatically then connect the segue of the tab bar controller to relationship segue then it will work. And then you are supposed to use Tab bar --> Navigation controller --> view controller