Problem presenting a UIActionSheet from a double tap in UITableViewCell
I am presenting a UIActionSheet when a user double taps my cell:
Tap Recognition in Cell Init:
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleDoubleTap:)];
[doubleTap setNumberOfTapsRequired:2];
[self addGestureRecognizer:doubleTap];
[doubleTap release];
Tell the delegate to handle the tap:
- (void)handleDoubleTap:(UITapGestureRecognizer *)recognizer {
NSLog(@"double oo");
[delegate handleDoubleTapp];
}
Now the delegate which is my UITableViewController will present the UIActionSheet:
-(void)handleDoubleTapp{
UIActionSheet *actionSheet = [[[UIActionSheet alloc]
initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Reply", @"Retweet", @"Direct Message", nil] autorelease];
[actionSheet showInView:self.parentViewController.tabBarController.view];
}
}
My UITableViewController implements the UIActionSheet delegate methods properly.
Problems:
- Not all areas of the actionsheet are responsive
- Clicking on a button presents a modal view, but the actionsheet does not get dismissed
- When buttons are able to be clicked, the开发者_运维百科y don't highlight
Just as a thought: did you try unregistering the UIGestureRecognizer once the UIActionSheet is about to become visible and re-registering it when the action sheet is dismissed? Maybe the recognizer is interfering with the touches.
精彩评论