Lnpopupcontroller: How to present popup bar on top of SWRevealController

Created on 26 Feb 2018  路  6Comments  路  Source: LeoNatan/LNPopupController

Hi friends,
Any Suggestion how can the pop up be shown in all views when used with sidebar menu like SWRevealController so that pop up can be shown in every view rear, front and right view.

question

Most helpful comment

    override func viewDidLoad() {
        super.viewDidLoad()

        self.revealButtonItem.target = self.revealViewController()
        self.revealButtonItem.action = #selector(PBRevealViewController.revealLeftView)

        popContentVC = self.storyboard?.instantiateViewController(withIdentifier: "PopupContentViewController") as! PopupContentViewController

        self.revealViewController()?.presentPopupBar(withContentViewController: popContentVC, animated: true, completion: {
            popContentVC.popupItem.image = #imageLiteral(resourceName: "genre1")
            popContentVC.popupItem.title = "Title"
            popContentVC.popupItem.subtitle = "Subtitle"
        })
    }

PBRevealPopupBar.zip

All 6 comments

    override func viewDidLoad() {
        super.viewDidLoad()

        self.revealButtonItem.target = self.revealViewController()
        self.revealButtonItem.action = #selector(PBRevealViewController.revealLeftView)

        popContentVC = self.storyboard?.instantiateViewController(withIdentifier: "PopupContentViewController") as! PopupContentViewController

        self.revealViewController()?.presentPopupBar(withContentViewController: popContentVC, animated: true, completion: {
            popContentVC.popupItem.image = #imageLiteral(resourceName: "genre1")
            popContentVC.popupItem.title = "Title"
            popContentVC.popupItem.subtitle = "Subtitle"
        })
    }

PBRevealPopupBar.zip

Thank you so much.. @iDevelopper @LeoNatan for wonderful libraries..

Hi, @iDevelopper @LeoNatan,

i managed to show the LNPopup bar to everyview as shown in above code in Revelmenu. The popup bar shows correctly but, when i switched to other view from left menu, then the button in the bar action does not work in popup bar. How to get button instance work from every view when moved to all views via left menu. Is it possible?

I have attached the project file where i navigate to new views from left menu. The buttons action only work in main view. How to control button from all views.

Any suggestion?

LNPopUpWithReveal.zip

Thanks

When the main view controller is ProfileVC for example, homeVC is dismissed then the selectors cannot be called. You can save a reference to homeVC for example in the left menu controller.

After that, when the selector is fired when you are in ProfileVC, homeVC has no parent (self.revealViewController is then nil. So you can retrieve the reveal view controller, it is in your case the application's root view controller.

Other solution, you can move the two selectors in the popup view controller. Search '// PB' in the project.

PBSideBarTest.zip

Thank you so much for response @iDevelopper . Grateful.

With pleasure! I think this issue (question) is relative to https://github.com/iDevelopper/PBRevealViewController not here.

Thanks,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnswifttt picture johnswifttt  路  8Comments

joaovbalmeida picture joaovbalmeida  路  9Comments

dancarasco picture dancarasco  路  6Comments

johnswifttt picture johnswifttt  路  5Comments

RajChanchal picture RajChanchal  路  5Comments