Skip to content

Dismissing keyboard in content controller when sliding left and back again #108

Open
@ptclarke

Description

@ptclarke

Have a problem with keyboard dismissal in a content controller. Resolved but not sure it is the best way:

Scenario: default segue slides to content controller with 3 text fields, tap on any text field, keyboard appears. Tap on done, keyboard disappears, tap on any text field, keyboard appears. Slide to left menu controller, keyboard still appears as editing has not ended in the content controller.

Solution in left menu controller (slide delegate) is to end editing in the content controller on slideMenuWillSlideToSide as follows:
// end editing and ensure keyboard hidden on visible controller
-(void) slideMenuWillSlideToSide:(UINavigationController *)selectedContent{
if ([[[selectedContent visibleViewController] view] respondsToSelector:@selector(endEditing:)]){
[[[selectedContent visibleViewController] view] endEditing:YES];
}
}

Would appreciate advice, Must be missing something, surely managing the keyboard must be easier than this.....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions