View Single Post
  #1 (permalink)  
Old November 14th, 2011, 10:18 PM
ggrngg ggrngg is offline
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 14 - Long Press

While testing out the example I found that I needed to tap the buttons twice. Thought it was something I did until I tested the sample code from the chapter and it did the same thing. After doing some research (for several hours) I found the solution. Modify the handleLongpressGesture and wrap it in the if (sender.state == UIGestureRecognizerStateBegan) block. Evidently since it is a "continuous gesture" it must be checked to see if the state began. Once I did that - viola - it worked perfectly. Just thought I'd post since it might help someone else out.

//handle Long Press Gestures
-(IBAction)handleLongpressGesture:(UIGestureRecognizer *) sender {
    if (sender.state == UIGestureRecognizerStateBegan) {
	UIActionSheet *actionSheet=[[UIActionSheet alloc]
			otherButtonTitles: @"Save Image",nil];
	[actionSheet showInView:self.view];	
	[actionSheet release];
Reply With Quote