I have a simple view that has two text images as well as a button. All controls are arranged vertically. I can navigate from one control to another using the remote control. However, I am trying to work with the following scenario:
- The user launches the application (the focus is on the first text field).
- The user enters a text field and uses a full-screen keyboard, then she clicks the "Next" button
- The application displays a second text field (full-screen keyboard), enters text in a specific text, and clicks "Finish"
- The application exits the full-screen keyboard and focuses the button
While step 1-3 works out of the box, changing the focus programmatically (4) does not work. Here is the code:
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if(textField == self.textfieldB) {
self.activeView = self.textfieldB;
[self setNeedsFocusUpdate];
[self updateFocusIfNeeded];
return YES;
}
return NO;
}
and in - (UIView *)preferredFocusedViewI return everything that is stored in self.activeView (yes, it will return an instance of the button). All methods are called expected, but the focus does not change. What am I doing wrong here?
Thanks in advance!
source
share