ios 11 color of the app (uinavigation) - ios

Am using this color for the UINavigationController and some of other views
[UIColor colorWithRed:0.137 green:0.137 blue:0.145 alpha:1.00]
but there is a strange behaviour with iOS 11 when I run the application sometimes the color is correct (dark) and sometimes the color be in light mode a lighter than the original color

Replace
[UIColor colorWithRed:0.137 green:0.137 blue:0.145 alpha:1.00]
with
[UIColor colorWithRed:137.0/255.0 green:137.0/255.0 blue:145.0/255.0 alpha:1.00]

Related

UITableViewCell reorder control clips view in iOS 13

I put a background image in a UITableViewCell to make it more visually appealing. In iOS 13, the background image is clipped by the reorder control.
This did not happen with older versions of the OS.
The code is simple:
// Put a border around mBackgroundImage. Make it slightly smaller than the size of the cell so that the border doesn't run all the way to the edges.
cell.mBackgroundImage.frame = CGRectMake(2, 2, cell.frame.size.width-4, cell.frame.size.height-4);
cell.mBackgroundImage.layer.cornerRadius = 4;
cell.mBackgroundImage.layer.borderColor = [UIColor colorWithWhite:0.92 alpha:1.0].CGColor;
cell.mBackgroundImage.layer.borderWidth = 1;
cell.mBackgroundImage.layer.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.95 alpha:1.0].CGColor;
Any suggestions?
Problem solved by setting cell.contentView.clipsToBounds to NO. It looks like cell.contentView.clipsToBounds=YES had been ignored prior to iOS 13.

UINaviagationBar ignoring background color settings [duplicate]

This question already has an answer here:
Unable to set barTintColor with custom RGBa in iOS7
(1 answer)
Closed 3 years ago.
ios 13, objective-c, can't get the navigation bar background color set.
I've tried setting the color via the UI in interface builder, and several examples off the web (and here).
UINavigationBarAppearance* navBarAppearance = [self.navigationController.navigationBar standardAppearance];
navBarAppearance.backgroundColor = [UIColor colorWithRed:172.0f green:193.0f blue:197.0f alpha:1.0f];
I would expect the above code to set the background color, but it's still white.
change this:
navBarAppearance.backgroundColor = [UIColor colorWithRed:172.0f green:193.0f blue:197.0f alpha:1.0f];
to this:
navBarAppearance.backgroundColor = [UIColor colorWithRed:172.0f/255.0f green:193.0f/255.0f blue:197.0f/255.0f alpha:1.0f];

Colours appearing different on iPhone 6 plus using UIImageRenderingModeAlwaysTemplate

I have a PNG image that I am re-colouring at runtime:
logo.image = [[UIImage imageNamed:#"logo.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
logo.tintColor = [UIColor whiteColor];
This appears white on my iPhone 6, all the simulators etc; but it is a slightly darker grey colour on an iPhone 6+. Could there be a reason I've missed?
Here's a screenshot of the iPhone 6+ (all the navigation items should be white - like every other device)
barTintColor is made translucent by default unless you set the
translucent property to NO.
Try this
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.translucent = NO;

UISegmentedControl always appears dim

No matter what settings I try, I cannot get UISegmentedControl to render with the tintColor I set. I took a few screenshots, and it seems whatever color I set, the rendered result is 20% darker (i.e. UIColor whiteColor ends up R:204,G:204,B:204)
I've tried every combination of the settings below, and nothing seems to change the fact it always looks darker. However, inspection of the tintAdjustmentMode at all stages before/after setting the values, appear, etc. comes out as UITintAdjustmentModeNormal. I can make the background color of the text render at full brightness, but the frame and selected index fill is always at 80% brightness. Oddly, this doesn't happen in the 7.1 Simulator, but it does happen on my iPhone 5 with 7.1.1.
Has anyone had similar problems? I've read many other threads about controls not dimming, or people wanting to set different colors for different parts of the control, but couldn't find any about tintColors that won't show at full brightness.
Various settings I've tried individually and together:
UIColor *tintColorToSet = [UIColor colorWithRed:0/255.0f green:241/255.0f blue:1.0f alpha:1.0f];
NSMutableDictionary *textAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
tintColorToSet, NSForegroundColorAttributeName,
[UIColor clearColor], NSBackgroundColorAttributeName,
[UIFont fontWithName:#"NesController" size:18.0f], NSFontAttributeName, nil];
[_lengthBar setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
[textAttributes setValue:[UIColor blackColor] forKey:NSForegroundColorAttributeName];
[_lengthBar setTitleTextAttributes:textAttributes forState:UIControlStateSelected];
_lengthBar.tintColor = tintColorToSet;
_lengthBar.alpha = 1.0f;
_lengthBar.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
Thanks for the help.

Style controls on iOS 6 with layers are wrong? (From iOS7)

I'm creating an app and I'm styling some controls like text fields and buttons with layers (for example changing the border color and thickness), or simply by changing the background color of the control from the Interface Builder.
On iOS 7 it's all working good, but when I run the application on iOS 6 (simulator) I see old style controls plus borders of the layer.
The two versions were running both with the iOS 6.1 SDK.
Here is the screen of what is happening: (I can't post images for the reputation on SO)
EDIT:
The code for the textfields i use is this:
UITextField* textField = (UITextField*) aView;
textField.layer.cornerRadius = 0.0;
textField.layer.borderColor = [[UIColor lightGrayColor] CGColor];
textField.layer.backgroundColor = [[UIColor whiteColor] CGColor];
And for the "Login" button i simply changed the background color in the IB.
In order to remove the border of the textFields, set the borderStyle to none:
textField.borderStyle = UITextBorderStyleNone;
As for the Login button, don't forget to set the button's type to Custom in IB.
Tell me if that works.

Resources