takashisite / TSPopover

UIPopover like UI for iPhone
Other
316 stars 68 forks source link

TSActionSheet for UITableViewCell #20

Closed elifsimit closed 10 years ago

elifsimit commented 10 years ago

Hi,

I want to use TSActionSheet for long press on table cell. I can handle long press;

//viewDidLoad UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];

lpgr.minimumPressDuration = 2.0; //seconds lpgr.delegate = self;

[myTableView addGestureRecognizer:lpgr]; //////////////

-(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer { if (gestureRecognizer.state != UIGestureRecognizerStateBegan) return;

CGPoint p = [gestureRecognizer locationInView:myTableView];

NSIndexPath * indexPath = [myTableView indexPathForRowAtPoint:p]; if (indexPath == nil) NSLog(@"long press on table view but not on a row"); else{ NSLog(@"long press on table view at row %d", indexPath.row); //!! I want to use TSActionSheet on this line with 'islemlerClicked' function } }

//////////////////////

-(void)islemlerClicked : (id)sender forEvent:(UIEvent*)event{

TSActionSheet *actionSheet = [[TSActionSheet alloc] initWithTitle:@"İŞLEMLER"];

///..... [actionSheet addButtonWithTitle:@"Yardım" block:^{ NSLog(@"Yardım button");

}]; actionSheet.cornerRadius = 5;

[actionSheet showWithTouch:event];

}

Thanks, Elif

elifsimit commented 10 years ago

I've read only open question. #2 is related to my question.