更改iOS Swift中导航栏项的Alpha值

Pav*_*vel 2 cocoa-touch uinavigationbar ios swift

在ViewDidAppear中,我将导航栏的alpha值更改为0.15,但右侧导航栏项也变得几乎不可见.

self.navigationController?.navigationBar.alpha = 0.15
Run Code Online (Sandbox Code Playgroud)

是否可以更改右侧导航栏项目的透明度/ alpha值,使其完全可见(alpha = 1),同时导航栏本身为0.15?

Wil*_*son 5

您将整个条形的alpha设置为0.15.你应该只将barTintColor它的属性设置为alpha为0.15的颜色,如下所示:

self.navigationController?.navigationBar.barTintColor = UIColor.yourColorGoesHere().colorWithAlphaComponent(0.15)