Is there a fix for this behavior?
This is a UISegmentedControl full default no special properties set at all.
Setting its alpha or the alpha of the superview shows this behavior, any suggestions or is this a bug ?
http://i.stack.imgur.com/k1L7K.png
Have the same problem :( No idea how to fix with UISegmentedControlStylePlain
But with it works with UISegmentedControlStyleBar, and you can also set a tintColor
[segmentedControl setSegmentedControlStyle:UISegmentedControlStyleBar];
[segmentedControl setAlpha:0.5];
[segmentedControl setTintColor:[UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0]];
Related
Im using:
#define colorApp [UIColor colorWithRed:254/256.f green:64/256.f blue:89/256.f alpha:1.0]
Inside the customSearchView init:
[self setBackgroundColor:colorApp];
searchBar = [[UISearchBar alloc] initWithFrame:frame];
searchBar.barTintColor = colorApp;
[self addSubview:searchBar];
Getting the next result:
I need the searchBarTint color to be the same as the navigation. Translucent doesn't seem to make the work.
I came up with the fix soon after I posted the question.
In case anyone ever faces this problem I used
[self.searchDisplayController.searchBar setBackgroundImage:[UIImage imageNamed:#"pinkBar.png"]
forBarPosition:0
barMetrics:UIBarMetricsDefault];
It seems backgroundColor and barTintColor aren't taking colors same way as the navigation for a UISearchDisplayController since iOS 7. But adding an image with that color just resolves that.
I know it's just a quick fix but it helped me and could help others as it is a minor visual issue.
I can't believe I don't see this anywhere on Google, but I have an odd issue.
I am changing the Global Tint in iOS 7 in the App Delegate:
[[UIView appearance] setTintColor:[UIColor redColor]];
However, when I display a table view with UITableViewCellStyle2 cells, the text title color is still the default blue color.
Any ideas on how I could fix this? I'd rather not subclass it.
Thanks!
simply change the text color.
cell.textLabel.textColor = [UIColor redColor];
I have searched quite a bit but cannot find a good answer to this.
I want to change the backgroundColor of the inner rounded view.
Like in Tweetbot on the search tap where it changes from gray to blue.
I understand that I probably need to iterate over the subviews but I don't know how to get the right object. (for the backgroundColor it's not the _searchLabel)
The default contrast of this element is so bad it's not even funny :(
Ok, this works. But note that you can't set a UIBarStyle beforehand or it will override everything.
https://stackoverflow.com/a/19836215/1252720
If you're still looking for a better answer, I just stumbled across this thread and found a great solution: UISearchBar text color change in iOS 7
If you look at the answer given by Sandeep-Systematix (not the accepted answer, but the answer right below), he mentions a really clean way to modify subviews in any class with this method:
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setTextColor:[UIColor blueColor]];
You can read more about this in Apple's documentation: https://developer.apple.com/library/ios/documentation/uikit/reference/UIAppearance_Protocol/Reference/Reference.html
That said, here's what you'll need to change the white, rounded background of the UITextField inside the UISearchBar:
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setBackgroundColor:[UIColor redColor]];
Now if you needed to create different UISearchBars with different styles, you would simply create a subclass of UISearchBar and you'd end up with something like this:
[[UITextField appearanceWhenContainedIn:[MyCustomSearchBar class], nil] setBackgroundColor:[UIColor redColor]];
Use this code.
_searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.contentView.bounds.size.width, 44.0f)];
_searchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
_searchBar.delegate = self;
[self.view addSubView:_searchBar];
UITextField *txfSearchField = [_searchBar valueForKey:#"_searchField"];
txfSearchField.backgroundColor = [UIColor redColor];
I'm writing an app on iOS 7, and I can't seem to get a handle on the transparency of the navigationBar and the toolbar, how can I set the navigation bar to black at 50% opacity?
I've read the transition to ios7 guide and I've watched the wwdc13 lecture 214, but my status bar still has a different transparency than the rest of the attached nav bar.
Here is my code:
// APP-WIDE THEMING
[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackOpaque];
[[UINavigationBar appearance] setBackgroundColor:[UIColor blueColor]];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Here is the screenshot of my problem: http://grab.by/qiyU
Set the background image to nil, and set the background color with alpha.
[ctrl.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
ctrl.navigationController.navigationBar.backgroundColor = [UIColor colorWithRed:0 Green:0 Blue:0 Alpha:.5];
According to the answer posted here it's possible to create a transparent UINavigationBar:
How to draw a transparent UIToolbar or UINavigationBar in iOS7
However you want to create a semitransparent navigationbar. For that as far as I can tell you have to create a 1 px large image containing a black color with 50% opacity. Add this as backgroundimage for your Navigationbar.
This snippet should do the trick:
[[UINavigationBar appearance] setBarStyle:UIBarStyleDefault];
UIImage* sti = [UIImage imageNamed:#"EMT_SemiTransparent.png"];
[[UINavigationBar appearance] setBackgroundImage:sti forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundColor:UIColor.clearColor];
try setting key [View controller-based status bar appearance] to NO in your pList file as well.
i've run into some funkiness with the status bar not seeming to be affected by changes in code and this solved it for me.
reference: https://stackoverflow.com/a/18184831/2962193
Set the alpha value to make it transparent.
[[UINavigationBar appearance] setAlpha:0.5f];
When I open my app, during the new animation of io7, the navigation bar is transparent and black without the color that I chose for barTintColor until the app loads. Why is this?
This was happening because the self.navigationController.navigationBar.translucent was YES. Setting it to NO fixed the problem. It also changes the color of my barTintColor and I had to adjust accordingly just FYI
UIColor *NavBarTintColor = [UIColor colorWithRed:0.223 green:0.223 blue:0.223 alpha:1.000];
[self.navigationController.navigationBar setTintColor:[UIColor lightGrayColor]];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:#"Image.png"] forBarMetrics:UIBarMetricsDefault];
At ios7, I use below code to set the color and it worked for me:
myNav.navigationBar.barTintColor = [UIColor redColor];