Saturday, April 1, 2023
HomeiOS Developmentios - NavigationController buttons not responding to touch

ios – NavigationController buttons not responding to touch

[ad_1]

This is my code to set up the navigationcontroller inside the ChatMessageVC:

        self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for:.default)
        self.navigationController?.navigationBar.shadowImage = UIImage()
        
        self.navigationController?.interactivePopGestureRecognizer?.delegate = self;
        self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true

        let button = NavButton(type: .custom)
 
        button.addTarget(self, action: #selector(actionBack), for: UIControl.Event.touchUpInside)
        let leftBarButton = UIBarButtonItem(customView: button)
        self.navigationItem.leftBarButtonItem = leftBarButton
        
        
        let btnFilter = UIButton.init(type: .custom)
        btnFilter.frame = CGRect(x: 0.0, y: 0.0, width: 34, height: 34)
        btnFilter.setImage(UIImage(named: "More_Menus"), for: .normal)
        btnFilter.addTarget(self, action: #selector(actionFilters(sender:)), for: .touchUpInside)
        
        let rightBarButton = UIBarButtonItem(customView: btnFilter)
        self.navigationItem.rightBarButtonItem = rightBarButton

        self.navigationController?.navigationBar.barTintColor = .kAppThemeLightPinkColor()
        self.navigationController?.navigationBar.isTranslucent = false
        self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for:.default)
        self.navigationController?.navigationBar.shadowImage = UIImage()
        

The above code works perfectly fine when the app is in foreground. However when I receive a push notification (when the app is not running (killed)) – click on the notification, the navigation buttons on ChatMessageVC are displayed but do not respond to touch.

Any help is appreciated.

[ad_2]

Source link

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments