O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Long Press to Enabled Text Field

The UIResponder class is responsible for all the events that happen in the user interface of iOS apps. It is the superclass of UIApplication and UIView, and thus, all of their subclasses, including UITextField. One of the methods in UIResponder is canPerformAction:withSender:, which is implemented in the subclasses of UIResponder to allow them to specify whether they can perform a particular action. In UITextField, the action that is relevant to be carried out is to begin editing the text field. Normally, canPerformAction:withSender: will return YES for UITextField. However, if the txtPhone field would return NO when it is in view mode, it could be kept enabled but still not allow editing. By creating a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required