Wrox Programmer Forums
|
BOOK: Beginning iOS 4 Application Development
This is the forum to discuss the Wrox book Beginning iOS 4 Application Development by Wei-Meng Lee; ISBN: 978-0-470-91802-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2011, 10:18 PM
Registered User
 
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.

Code:
//handle Long Press Gestures
-(IBAction)handleLongpressGesture:(UIGestureRecognizer *) sender {
    if (sender.state == UIGestureRecognizerStateBegan) {
	UIActionSheet *actionSheet=[[UIActionSheet alloc]
			initWithTitle:nil 
			delegate:self 
			cancelButtonTitle:@"Cancel" 
			destructiveButtonTitle:nil
			otherButtonTitles: @"Save Image",nil];
    actionSheet.actionSheetStyle=UIBarStyleBlackTranslucent;
	[actionSheet showInView:self.view];	
	[actionSheet release];
    }
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 13 decompression error 0x80010135 - Path too Long whunter31 BOOK: Professional WCF 4: Windows Communication Foundation with .NET 4 6 July 27th, 2017 09:13 AM
Chapter 14, first 'Try It Out' alharlow BOOK: Beginning ASP.NET 4 : in C# and VB 5 March 18th, 2011 05:00 AM
chapter 14 vthunder70 BOOK: Beginning ASP.NET 2.0 and Databases 2 October 3rd, 2007 02:11 PM
Modifying long text in a long field sajsal Classic ASP Databases 1 February 20th, 2004 12:36 PM
Chapter 14 Mike Smith BOOK: Professional C#, 2nd and 3rd Editions 2 January 4th, 2004 05:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.