Inactive UIBarButtonItem
Does someone know how the inactive done button in the Co开发者_如何转开发ntacts App is done?
I would like to implement something similar.
So far I haven't seen any inactive property on UIBarButtonItem...
Use the enabled
property. Of course, you'll need to use your own validation checks on the input controls in your view controller, to determine whether or not to set it enabled.
// Assuming the Done button is on the right
[self.navigationItem.rightBarButtonItem setEnabled:NO]; // Disables the button
The enabled
property is found in UIBarItem
, the class from which UIBarButtonItem
inherits, which is why you won't find it in the UIBarButtonItem
docs.
精彩评论