Reputation: 2487
In the Code below, i created 2 right bar buttons using swift 2.
At this moment, i want to make something like that:
accountButton.disable = false
But that is not possible.
What is the best solution to disable this bar button ?
let accountImage = UIImage(named: "account")!
let settingImage = UIImage(named: "setting")!
let accountButton = UIBarButtonItem(image: accountImage, style: .Plain , target: self, action: "didTapEditButton:")
let settingButton = UIBarButtonItem(image: settingImage, style: .Plain, target: self, action: "didTapSearchButton:")
navigationItem.rightBarButtonItems = [accountButton , settingButton]
Upvotes: 3
Views: 2153
Reputation: 12910
Try:
Swift 2
accountButton.enabled = false
Swift 3
accountButton.isEnabled = false
Upvotes: 4