I have multiple storyboards in my app and for one specific storyboard I wish to have a different color scheme. This may not be according to iOS 7 guidelines but nonetheless, I am wondering if there is a way to change the tint color for every UIControl for a particular storyboard.
Yes, if you go to the File inspector, you can set the global color per storyboard. In fact, I don't think you can set the tint color for multiple storyboards at once (aside from doing it in code).
Select the File inspector:
The second section looks like this:
Change the Global Tint, and that color will be the tint color for your entire storyboard.
From Code Swift 3
you can change tint for all view using one line of code
UIView.appearance().tintColor = UIColor.green
Related
The navigation barTintColor doesn't change when "prefers large titles" is selected. I tried changing it from Attribute Inspector and also programmatically. I can see the color change in storyboard but not while I run the app. I have the same problem with the titleColor as well.
Yes you need to change the backgroundColor of the navigationBar for the largeTitle mode. It's completely different from the normalMode.
With Storyboard
or
With Code
navigationController?.navigationBar.backgroundColor = .brown
Result
Note that the top white area is actually the backgroundColor of the RootViewController and you need to handle it manually.
try different colors for each one and play to more understand the behavior
This is very odd. My global tint is set and my icons colors are set to the default purple I have. Yet at run time its blue. Any tips? Ive checked around and have not seen anyone else with this problem.
Storyboard:
Run Time:
Basically, when you want to change the tint color of UITabBar programmatically, UITabBar class gives you several tint color properties:
tintColor: TabBarItem's color.
barTintColor : TabBar's background bar's color.
unselectedItemTintColor : color of unselected items.
so if you change the tintColor, barItems' color would be changed.
...but, Why it doesn't works on IB?
When you set a specific color to UITabBar's item in IB, there's an option named Image Tint.
Changing a Tint option on "View" section won't affect anything to TabBar's items but only Image Tint option can change tabBar's item color.
storyboard's global tint color option changes Tint option of "View" section, but doesn't affect default value of Image Tint option, so It doesn't affect the tab bar's tint color.
So.. Why Image Tint option doesn't affected?
I can't explain why doesn't it affected. Maybe Apple had an issue with this, or kind of bug.
there are some workarounds for setting an image color :
Explicitly Set an Image Tint option to UITabBarController's TabBar object.
You may should set every TabBarController's Image Tint option, because it doesn't affects global setting.
Programmatically change global UITabBar's tintColor.
At AppDelegate.swift's didFinishLaunchingWithOptions, paste following code
UITabBar.appearance().tintColor = <#Color what you want#>
I've had a similar problem, which was fixed by changing the "Render As" property to "Default" instead of "Original". You can find this in your Asset Library, when selecting your images on right right hand side under "Render As" in the attributes inspector.
My app has separate code and bundle (xib are to be downloaded separately). I can't change my code yet and I have to change xib file.
On ios 7, I can see correctly like this when I change in my xib.
With that setting, on my ios 6, selected color and unselected color become same (black). User can't differentiate.
How can I change in my xib so that behaviour is correct? (I can't change my code for now. I can only change xib). If Tint color is default, it is okay but I still need it to be black color.
you are setting tint color, which is correct approach. It’s background color is white that means it’s default color and you are setting black color as tint color so it is also fine.
So make sure that your SegmentControl’s style is plain and state is not checked beside Momentary. Make sure that state is unchecked. If it is checked then uncheck it. You can check all this under attribute inspector with your segmented control selected.
I don't understand why the background color setting in the storyboard doesn't work for my navigation controller? (See picture)
http://ctrlv.in/299323
I have here set it to bright red but as you can see it does nothing in the storyboard or to the app when I build it.
Any thoughts?
I know I can set the color programmatically, and this is what I am currently doing. However, it would be nice to see the changes in the storyboard so I don't have to build the app every time I make a color change to see the difference.
Yes you can. Notice that you're changing UIView properties not Navigation bar. Look at the screen below:
You have to set Bar Tint property.
I am facing a very strange issue with XCode 4.5.
I tried to set a background color to a prototype cell in my storyboard, but in interface builder the cell color doesn't change, even when I run it on my device it doesn't use the color I set.
I tried creating a subclass of UITableViewCell and setting the color of the background in all init methods but it still donnot work.
PS: XCode 4.5.1 and iOS 5 or 6, same issue. Since I'm a new developer I cannot recall if it worked on previous versions of XCode.
I was able to add a background color to a prototype UITableViewCell inside of a storyboard in Xcode 5.
First, select the cell that you want to give a background color.
Next, goto View -> Utilities -> Identity Inspector and add a new User Defined Runtime Attribute for a Keypath of "backgroundColor" a type of "Color" and a "Value" of whatever color you want.
#dvkch: I don't know how you did it with deleting and recreating segues. The only way I know to set the background color of table view cell is to set the content views background color of the cell:
cell.contentView.backgroundColor = [UIColor orangeColor];
Sadly, storyboard doesn't show the content views properties.
EDIT
If you change the background color of the table view the background color of the cell changes, too.
It finally worked after some Clean and Clean build folder operations, some deletion of segues and after recreated them... Thanks Xcode 4.5 !
EDIT: after multiple tests: on iOS6 and 7 you actualy should be able to set the correct background color in storyboards or your code by setting the background color on the cell prototype itself and the contentView. Those are not the same objects in a storyboard. I hope that helps.