Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS UIActionSheet presented from LongPress gesture on a button erroneously requires double clicking buttons to dismiss
    primarykey
    data
    text
    <p>I have a tabbar application, in one of the tabs I have a MKMapView. In this view, my viewDidLoad I am initializing a long press gesture recognizer for a UIButton. When this button is pressed and help it presents a UIActionSheet with 5 buttons + the cancel button. Each button represents a zoom level: "World", "Country", "State", "City", "Current Location". Selecting a button in the UIActionSheet zooms the underlying MKMapView to that level. </p> <p>The problem I am having is that all of the buttons (including the cancel button) require double-tapping to dismiss the UIActionSheet. This is not the intended behavior -- it should dismiss after pressing the button once like every other UIActionSheet. After the first press I can see the map zooming to the appropriate level behind the UIActionSheet so I know the touch is registering on the correct button, but the button does not highlight blue upon the first press and the UIActionSheet does not dismiss. Not until I press the button for a second time does it highlight blue and then dismiss. </p> <p>If I remove the longpress gesture recognizer and present the UIActionSheet on a 'touch up inside' then everything works as it is supposed to. So I know the gesture is somehow interfering, any ideas on a fix or workaround? Or is this a bug that should be reported to Apple?</p> <pre><code>- (void) viewDidLoad { // intitialize longpress gesture UILongPressGestureRecognizer *longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(zoomOptions:)]; longPressRecognizer.minimumPressDuration = 0.5; longPressRecognizer.numberOfTouchesRequired = 1; [self.currentLocationButton addGestureRecognizer:longPressRecognizer]; } - (IBAction) zoomOptions:(UIGestureRecognizer *)sender { NSString *title = @"Zoom to:"; UIActionSheet *zoomOptionsSheet = [[UIActionSheet alloc] initWithTitle:title delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"World", @"Country", @"State", @"City", @"Current Location", nil]; [zoomOptionsSheet showFromTabBar:appDelegate.tabbarController.tabBar]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload