I have a UIView with two buttons on it. In the MyView class I have this code:
-(BOOL) canBecomeFocused {
return YES;
}
-(NSArray
You can override the preferredFocusEnviromnets with the following logic:
-(NSArray> *)preferredFocusEnvironments {
if (condition) {
return @[_editButton];
}
else {
return @[_addButton];
}
}
After setting it, you can call
[_myView setNeedsFocusUpdate];
[_myView updateFocusIfNeeded];
The condition could be BOOL condition = tableViewController.editing; or sg like that.
If that now works, you can call it with a delay (0.1 sec or so).