Friday, August 24, 2012

An addendum to UITextField delegate guides

Hi.

I'll be posting more programming notes in the future. So that I don't forget them.

Maybe you’re working on an iOS app. And maybe you’ve got a text field, and you want the keyboard to go away, because you’re finished with it.

Presentation styles?
But for some reason it won’t go away. So you double check guides and tutorials and documentation. You even find a few things that seem forehead-slappingly obvious.

“Oh. That’s it,” you exclaim, and make that fix.

Only it still doesn’t work.

You read the UITextField class reference, again, exhaustively, to no avail.

Is your view controller a modal view controller?

Is its presentation style UIModalPresentationFormSheet?

Welcome to a fun and exciting exception! What you’re looking for is:

UIViewController -(BOOL)disablesAutomaticKeyboardDismissal
Override it to return NO. And then have a nice day.

This tip brought to you by the letter D.



No comments:

Post a Comment