Search code examples
swiftuinavigationcontrolleruinavigationbarwkwebviewavplayer

AVPlayer Subtitle selection screen's Done button is always in white color


Our app navigation bar is in white color, it is push a viewcontroller to load some html content in WKWebview, the content page has some videos. On tapping the video, WKWebview launching the Video player.

At this case, Users trying to change the subtitles, subtitle navigationbar background color is white as per parent and the done button in this screen also coming as white color(became not visible).

 UINavigationBar.appearance().barTintColor = .green
 UINavigationBar.appearance().tintColor = .red
 UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.yellow]
 UINavigationBar.appearance().isTranslucent = false

This theme is applying on to the navigation controller not for the Done button in the right side of Audio & Subtitle Screen.

Any tweaks to overcome this issue ?

Screenshot1 ScreenShot2


Solution

  • Many mentioned like, UINavigationBar.appearance().barTintColor can change navigation item color as well.

    But below code helped me out to change the Done button color

    UIBarButtonItem.appearance().tintColor = .green