Change color of translucent black UINavigationBar

前端 未结 4 1425
后悔当初
后悔当初 2020-12-24 05:45

I stumbled upon this many times, never found a solution. A UINavigationController\'s navigationBar can be set to black translucent like:

self.navigationContr         


        
4条回答
  •  误落风尘
    2020-12-24 06:44

    To mimic more accurately the translucent effect, meaning that only the background of the navbar is translucent, and the buttons, title and everything else are opaque, you can do like this:

    self.navigationController.navigationBar.translucent = YES;
    [(UIView*)[self.navigationController.navigationBar.subviews objectAtIndex:0] setAlpha:0.7f];
    

提交回复
热议问题