ICoder
ICoder

Reputation: 1347

How to set time for touch the cell in a tableview?

Ha ii everybody i have a tableview ,when i click the cell it popups a view,its work fine for me,but my question is, i want to tap for 2 second to popup appear.that is ,if i tap the cell for 2 second then only the popup appers.Is that possible?How can i do this?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.view addSubview:MainPopupView];
//MainPopView is the popup that i want to display after2 minit
}

Thanks in advance.

Upvotes: 0

Views: 110

Answers (1)

visakh7
visakh7

Reputation: 26400

Give the UILongPressGestureRecognizer a try. You can set the minimumPressDuration to set the time for the gesture to be recognized.

You can add UILongPressGestureRecognizer to your table view cell and get the desired action.

Update Please take a look at this previous SO question How can I determine if a user has pressed on a UITableViewCell for 2 seconds?

Upvotes: 1

Related Questions