- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save", nil) style:UIBarButtonItemStylePlain target:self action:@selector(save:)];
// ...
self.navigationItem.rightBarButtonItems = @[saveButton, someOtherButton];
self.saveBarButtonItem = saveButton;
}
- (void)someMethod
{
[self.navigationItem.rightBarButtonItems enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop){
UIBarButtonItem *barItem = (UIBarButtonItem *)obj;
if ([barItem.title isEqualToString:NSLocalizedString(@"Save", nil)]) {
barItem.enabled = NO;
}
}];
}
Задача: включать/выключать кнопку по определенному событию.
tonygluk 11.10.2014 21:37 # 0