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 ...

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.