简体   繁体   中英

Navigation barButton item not visible but Actionable iOS Swift

Here is my code for rightBarButton item:

let rightBarButton = UIBarButtonItem(
            title: "Apply",
            style: .plain,
            target: self,
            action: #selector(saveShotData)
        ) 
    navigationItem.rightBarButtonItem = rightBarButton

Have you tried:

rightBarButton.isHidden = false

if you want it to be hidden and not working, then try

rightBarButton.isUserInteractionEnabled = false

isHidden only hides - it does not disable. And unfortunately.isHidden doesn't adjust layout / hide the button - so if you have two right bar button items, they layout doesn't nicely update - though there are creative ways you can get around that if required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM