LeoNatan / LNPopupController

A framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
MIT License
3.04k stars 340 forks source link

Unable to match color of popupBat with navBar #237

Closed yarodevuci closed 6 years ago

yarodevuci commented 6 years ago

simulator screen shot - iphone se - 2018-03-01 at 19 33 31 I went through example, tried different code and I am getting weird results.

Here is my code. What I am doing wrong? I don't have tabBarController. I am using just regular TableViewController with NavBar. Hopefully @LeoNatan can help.

func setupMimiMusicPlayerView() {

        UIProgressView.appearance(whenContainedInInstancesOf: [LNPopupBar.self]).tintColor = .pinkColor
        navigationController?.popupBar.progressViewStyle = .top
        navigationController?.popupInteractionStyle = .drag

        navigationController?.toolbar.tintColor = .splashBlue
        navigationController?.toolbar.barStyle = .black

        self.navigationController?.navigationBar.barStyle = .blackTranslucent
        //self.navigationController?.updatePopupBarAppearance()
        navigationController?.popupBar.tintColor = .white//UIColor(white: 38.0 / 255.0, alpha: 1.0)
        self.navigationController?.updatePopupBarAppearance()

//        UIProgressView.appearance(whenContainedInInstancesOf: [LNPopupBar.self]).tintColor = .red
//
//        navigationController?.popupBar.tintColor = UIColor(white: 38.0 / 255.0, alpha: 1.0)
//        navigationController?.popupBar.imageView.layer.cornerRadius = 5
//        navigationController?.popupBar.barStyle = .default
//        navigationController?.popupInteractionStyle = .drag
//        navigationController?.popupBar.progressViewStyle = .top
//        navigationController?.popupBar.barTintColor = .splashBlue
//      navigationController?.popupBar.isTranslucent = true
//      if #available(iOS 10.0, *) {
//          navigationController?.popupBar.backgroundStyle = .light
//      } else {
//          // Fallback on earlier versions
//      }
//      self.navigationController?.updatePopupBarAppearance()
    }
LeoNatan commented 6 years ago

Forgive my untrained eye, but I don't see a radical change in popup bar and navigation bar color. The prominent popup bar is intended to have a very slight shift in color. Remember that it takes its coloring from the toolbar, not the navigation bar, so apply all customization on that as well.

yarodevuci commented 6 years ago

yes but on your example nav and popupbar having exact same colors. So i need to set toolbar color to whatever color is for nav bar @LeoNatan ? I did that if you saw that navigationController?.toolbar.tintColor = .splashBlue and there is no changes

LeoNatan commented 6 years ago

You are using the wrong tint color property. Use barTintColor.

yarodevuci commented 6 years ago

@LeoNatan it is still looks slightly darker. My nav bar is Translucent and I set translucency to bottom bar too but that does not help. Anything else I can try ?

My cleaned up code is

navigationController?.toolbar.barStyle = .black
navigationController?.toolbar.barTintColor = .splashBlue
navigationController?.popupBar.tintColor = .white
navigationController?.updatePopupBarAppearance()
LeoNatan commented 6 years ago

Try adding a little alpha to the .splashBlue.

yarodevuci commented 6 years ago

@LeoNatan is there anyway to disable UIVisualEffectView?

LeoNatan commented 6 years ago

If you disable the popup bar translucency, the effect view is hidden and only the bar tint color will remain. But you lose translucency, which is not what you want, I think.

yarodevuci commented 6 years ago

Right, I even took this line code off navigationController?.toolbar.barTintColor = .splashBlue and color remained the same

LeoNatan commented 6 years ago

You can apply the customization directly to the popup bar. Set inheritsVisualStyleFromDockingView to false, and then apply your customization there.

For more info, https://github.com/LeoNatan/LNPopupController/blob/master/LNPopupController/LNPopupController/LNPopupBar.h

yarodevuci commented 6 years ago

Did not helped either, but I ll close the issue for now. @LeoNatan