Pinch Recognizer in Action

The tap recognizer was pretty simple. Now, let’s do something more interesting with a pinch recognizer. A pinch recognizer will be set up to resize myGestureView. In the viewDidLoad method for the view controller, comment out the code that sets up the tap gesture, and uncomment the following code to set up the pinch gesture recognizer:

UIPinchGestureRecognizer *soloPinchRecognizer =[[UIPinchGestureRecognizer alloc] initWithTarget:selfaction:@selector(myGestureViewSoloPinched:)];[myGestureView addGestureRecognizer:soloPinchRecognizer];[soloPinchRecognizer release];

Next, create the method specified as the target for the pinch recognizer. Note that the method will have to inspect the pinch ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK 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.