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

How to remove that blur effect in popupbar? #463

Closed CivelXu closed 3 years ago

CivelXu commented 3 years ago

I create a CustomBarView extend LNPopupCustomBarViewController class, I want remove hairline、blur effect any views inherit form super.

How can I achieve it

I find related issues from https://github.com/LeoNatan/LNPopupController/issues/294

popupBar.isTranslucent = false
popupBar.backgroundColor = .clear

Use this api does not work

CivelXu commented 3 years ago
        containingPopupBar.subviews.forEach {
            if $0.isKind(of: UIVisualEffectView.self) {
                $0.isHidden = true
            }
        }

I can do it this way, but it's not very friendly.

LeoNatan commented 3 years ago

What happens if you use the new appearance API to configure the bar appearance to be opaque and set the background color in the appearance to clear?

https://github.com/LeoNatan/LNPopupController/blob/master/LNPopupController/LNPopupController/LNPopupBarAppearance.h

CivelXu commented 3 years ago

I try to used this api in demo project in ManualLayoutCustomBarViewController.swift viewDidLoad

        let appearance = LNPopupBarAppearance()
        appearance.configureWithTransparentBackground()
        containingPopupBar.standardAppearance = appearance

I expect there will be a transparent bar, but nothing happened.

LeoNatan commented 3 years ago

I just opened ManualLayoutCustomBarViewController.swift and added the following code to viewDidLoad():

override func viewDidLoad() {
    super.viewDidLoad()

    let appearance = LNPopupBarAppearance()
        appearance.configureWithTransparentBackground()
        containingPopupBar.standardAppearance = appearance

    centeredButton.setTitle("Centered", for: .normal)
...

And it works as expected:

Simulator Screen Shot - iPhone 12 Pro Max - 2021-06-29 at 13 11 36

Notice the labels at the bottom sit on top of a transparent bar.

LeoNatan commented 3 years ago

Also behaves correctly in the second example:

Simulator Screen Shot - iPhone 12 Pro Max - 2021-06-29 at 13 18 11