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

Long Press Gesture

In MyContactList, calling a phone number is a very useful feature. It will be implemented to allow the user to long press on the phone number on the Contact screen to call the number. A long press means that the user holds a little longer than a regular tap—about one second. To set this up, you need to add these two lines to viewDidLoad: in LMAContactsController.m:

UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]                                          initWithTarget:self                                                  action:@selector(callPhone:)];[_txtPhone addGestureRecognizer:longPress];

The first line sets up a gesture recognizer, which is a special object ...

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