i tried changing UIActivityViewController by subclassing it but it never worked, also trying to set it before presenting :
activityViewController.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
Is there is any possible way to do that ? at least to change bar button item tint colors !
Note: I dont want to change my current navigationbar colors, just inside the UIActivityViewController !!
Following code maybe help you:
[[UINavigationBar appearance] setBarTintColor:[UIColor purpleColor]];
[[UINavigationBar appearance] setTitleTextAttributes:#{ NSForegroundColorAttributeName: [UIColor whiteColor]}];
It's code help u so try my code
Related
My app uses a blueish color for the navigation bar. I set it globally in the AppDelegate like this:
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.0 green:0.4705882353 blue:0.7450980392 alpha:1.0]];
The problem is that when the user shares a PDF file via email with a UIDocumentInteractionController, the 'Cancel' and 'Send' buttons are also close to blue, which makes them almost invisible.
I tried:
[[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:#[[UINavigationBar class]]] setTintColor:[UIColor whiteColor]];
and
[[UIButton appearanceWhenContainedInInstancesOfClasses:#[[UINavigationBar class]]] setTintColor:[UIColor whiteColor]];
This works everywhere else in my app, but not on screens presented from the UIDocumentInteractionController.
How can I change the colors of these buttons?
you need to set window tint color if you want to change color of bar button in UIDocumentInteractionController.
Add Below line of code after your code of Set NavigationBar tint color.
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.0 green:0.4705882353 blue:0.7450980392 alpha:1.0]];
// Add this line...
self.window.tintColor = [UIColor whiteColor];
This is working for me.
Note : if you want to reset window tint color use below delegate of UIDocumentInteractionController.
- (void)documentInteractionControllerDidDismissOpenInMenu:controller{
// restore the tintColor which you set # app delegate
self.appDelegate.window.tintColor = [UIColor redColor];
}
Hope this will help you.
I'm calling UITabBar.appearance().tintColor = Constants.MAIN_COLOR in my didFinishLaunchingWithOptions but no matter what I change that color value too, my tab bar icons always appears the color of the actual image when selected. Any idea why my tab bar icons are not changing to the color defined in the code above? I made sure I wasn't calling the UITabBar.appearance() anywhere else in my project as well by doing a search.
Are you using custom icons? Then try these methods:
[[UITabBar appearance] setSelectedImageTintColor:[UIColor whiteColor]];
and for text:
[[UITabBarItem appearance] setTitleTextAttributes: #{ UITextAttributeTextColor: [UIColor someColor]}
forState: UIControlStateHighlighted];
I'm using Objective-C. Here I need to change the background color of an UINavigationBar. And I tried this code below:
self.navigationController.navigationBar.backgroundColor = [UIColor greenColor];
But the result is:
What I want is change the color of the NavigationBar into the green color below instead of a blurry green as it is now. Someone please help me.
do like select your Naigation Bar on storyboard and change the property of bar tint in directly in inspector
Just add this code
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
Try to use appearance
[[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];
[[UINavigationBar appearance] setTintColor:[UIColor greenColor]];
Hope this help
I am able to change tho color of NavigationBar by giving BackgroundColor but than I am not able change the color of StatusBar. Please provide a solution.
You should change the barTintColor instead of the background color.
[self.navigationController setBarTintColor:[UIColor redNavigationBarColor]];
Chances are that you will probably need to change also the barButton color and/or the the title color and all that should probably apply to more than one screen. So, to save you some time, if you want to globally change all these, put the code below in your app delegate
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
[[UINavigationBar appearance] setTitleTextAttributes:#{NSForegroundColorAttributeName : [UIColor whiteColor]}];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
The code above will give you a red navigation bar with white title & buttons
After upgrading Xcode in iOS7.1 my navigation bar and UIToolbar buttons are not shown with correct colour.
When a view first appears the UIToolbar buttons all have the correct default blue colour and when I go to next page/view and come back to the previous view the toolbar buttons are shown in a grey colour.
I have tried to add the blue colour in viewDidLoad and viewWillAppear but no luck. Can someone please help me?
Thanks.
You can set up a theme for certain components all at once and they will be used throughout your application. In my app delegate I created a function when the application is initializing called setupTheme, and it does just that - sets up the "theme" of the application by saying things like [[UINavigationBar appearance] setBarTintColor:], which in effect sets the color of the navigation bar for ANY navigation controller throughout the app. Here's an example from an app that sets up some basic components that are reused so that any time you use them they will already have the correct theme applied.
- (void)setupTheme {
// get our theme colors
UIColor *primaryThemeColor = [UIColor blueColor];
UIColor *secondaryThemeColor = [UIColor whiteColor];
// nav bar
[[UINavigationBar appearance] setBarTintColor:primaryThemeColor];
[[UINavigationBar appearance] setTintColor:secondaryThemeColor];
[[UINavigationBar appearance] setTitleTextAttributes:#{NSForegroundColorAttributeName:secondaryThemeColor}];
// tab bar
[[UITabBar appearance] setTintColor:primaryThemeColor];
// switches
[[UISwitch appearance] setOnTintColor:primaryThemeColor];
// search bar
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTitleTextAttributes:#{NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateNormal];
}
Check out the iOS 7 transition guide for more details on specifics https://developer.apple.com/library/iOs/documentation/UserExperience/Conceptual/TransitionGuide/Bars.html#//apple_ref/doc/uid/TP40013174-CH8-SW1