I can't seem to change the tint color for selected UITabBarItem in iOS 10. It was working perfectly in iOS 9. I'm using Swift 2.x and have tried using self.tabBar.tintColor programmatically, and runtime attributes in storyboard as well.
Use like this;
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.redColor()], forState:.Selected)
Thanks
Related
my app is behaving strangely. I think that it might have something to do with swift 3 and iOS 10 because until then it worked perfectly and I haven't touched the code of the things that changed.
So the problem is that I've set a backgroundColor in InterfaceBuilder to orange, I can see the color set on the view in my Storyboard, but when I run the app it just is white/clear (I have a white background)
the same thing happened to a subclass of a button, when its toggled OFF it should have a grey-ish color, now its just white.
I tripple checked if I'm not changing anything in the code, didn't find nothing.
Did something similar happened to you?
Do you have any ideas?
It happened to me too, after updating to xcode 8.0
try resetting the constrains and add those again to the particular view
I'm working on an OS X application with Xcode and swift, and I am trying to get the color of the clicked NSTabView to change from it's default blue color. I can't seem to find much information on this, and when I do it is really old. It seems like it is much easier to make changes with iOS, but I specifically need changes on my OS X App in Swift.
Can you not do it within Interface Builder?
I have done that by changing the colour of window where I am switching from one tab to other.
[windowMain setBackgroundColor:[NSColor grayColor]];
or any colour.
My setting for the project:
Deployment target: iOS6.1
Base SDK: 7.0
IB Document: Opens in 5.0
When I run app in simulator(7.0) I see almost what I expect (I don't understand why barbuttons don't use color tint — on previous screen it shows blue):
But if app is running on a device (also 7.0),
Then I see:
As you can see this is some kind of iOS6 UI, but tableview goes under the navbar, which became transparent.
Why does it happen?
Behavior of tintColor for bars has changed on iOS 7.0, please check the image below:
So now to change the tint color for your bar buttons you need to use tintColor which is the color for the interactive elements within a navigation bar including button images and titles.
While barTintColor is the background color of the UINavigationBar.
So basically
For buttons and title:
[[UINavigationBar appearance] setTintColor:[UIColor grayColor]];
For bar tint:
[[UINavigationBar appearance] setBarTintColor:[UIColor lightGrayColor]];
For the tableVIew under the navBar part, set navigationBar.translucent = NO;
I enabled Autolayout in IB, and now it uses iOS7 on a device too.
Upd.: After some time it start show strange design again. It gone only after I set iOS7 as base and deployment SDK.
I want to make custom appearance for UISearchBarin iOS 6 app, so I am trying to set tint color for it in Interface Builder as clear color. But when I am choose clear color in list it automatically changed to black! I am using Xcode 4.6.3
Is it an Xcode bug or this behavior is due to reasons?
So in my app I am creating, when it is run in the simulator I see the white background images, instead of my transparent background I set. This is with an XIB and not a Storyboard for what it matters.
Examples:
iOS 5.1 and below:
iOS 6 and above:
Does anyone know why this is happening and how to fix this?
I fixed this problem by instead of using a transparent background png, setting the button type to custom, not rounded-rect. This fixed the problem with white backgrounds being shown.