Here is a few ObjectiveC lines of code to perform what you want to do :
// Create button
UIButton *b = [[UIButton alloc] init];
// Set it's title
[b setTitle:@"AAA" forState:UIControlStateNormal];
// Set the label, i.e. it's name
[b setAccessibilityLabel:NSLocalizedString(@"AAA", @"")];
// Set button action description
[b setAccessibilityHint:NSLocalizedString(@"AAA button action description", @"")];
// Ad the button target, it's action
[b addTarget:self action:@selector(yourMethod:) forControlEvents:UIControlEventTouchUpInside];
// Add an observer
[b addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];
// Implement this method in your controller
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
if (object == self.b && [keyPath isEqualToString:@"state"]) {
if (self.b.state == UIControlStateSelected) {
// DO WHAT YOU WANT TO DO ON SELECTION
}
}
}
Take a look at Apple accessibility Guide for more infos.