开发者

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:

  1. Not all areas of the actionsheet are responsive
  2. Clicking on a button presents a modal view, but the actionsheet does not get dismissed
  3. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜