Get the right color in iOS7 translucent navigation bar

后端 未结 20 1260
囚心锁ツ
囚心锁ツ 2020-11-28 00:59

How can I get the right coloring for my translucent navigation bars in iOS 7? The navigation bar just adjusts the given color to a much brighter one. Changing brightness or

20条回答
  •  醉话见心
    2020-11-28 01:35

    This works for me:

    CALayer *layer = [CALayer layer];
    layer.frame = CGRectMake(0, -20,navigationBar.frame.size.width,navigationBar.frame.size.height + 20);
    layer.backgroundColor = [[UIColor blueColor] colorWithAlphaComponent:0.75].CGColor;
    layer.zPosition = -5;
    [navigationBar.layer addSublayer:layer];
    

提交回复
热议问题