I\'m having an issue with a UIBarButtonItem
. I use the appearance proxy to set its color for states Normal
and Disabled
and I do this in t
Check with following code
.
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem * btnTemp = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(btnDone_Click:)];
[btnTemp setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor lightGrayColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:16.0f]} forState:UIControlStateNormal];
[btnTemp setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blueColor], NSFontAttributeName:[UIFont systemFontOfSize:16.0f]} forState:UIControlStateDisabled];
[self.navigationItem setRightBarButtonItem:btnTemp];
}
- (void)btnDone_Click : (id)sender {
UIBarButtonItem * button = (UIBarButtonItem *)sender;
[button setEnabled:FALSE];
[self performSelector:@selector(enableButton:) withObject:sender afterDelay:2.0f];
}
- (void)enableButton : (id)sender {
UIBarButtonItem * button = (UIBarButtonItem *)sender;
[button setEnabled:TRUE];
}