大佬教程收集整理的这篇文章主要介绍了iphone – 如何在定制的UITableviewCell中检测到滑动到删除的手势?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
现在我想我必须实现我自己的逻辑,以避免默认删除按钮和缩小在UITableViewCell的默认实现中刷卡删除的动画.
也许我必须使用UIGestureRecognizer?
// Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reusEIDentifier:CellIdentifier] autorelease]; } // Configure the cell. UISwipeGestureRecognizer* sgr = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@SELEctor(cellSwiped:)]; [sgr setDirection:UISwipeGestureRecognizerDirectionRight]; [cell addGestureRecognizer:sgr]; [sgr release]; cell.textLabel.text = [NSString StringWithFormat:@"Cell %d",indexPath.row]; // ... return cell; } - (void)cellSwiped:(UIGestureRecognizer *)gestureRecognizer { if (gestureRecognizer.state == UIGestureRecognizerStateEnded) { UITableViewCell *cell = (UITableViewCell *)gestureRecognizer.view; NSIndexPath* indexPath = [self.tableView indexPathForCell:cell]; //.. } }
以上是大佬教程为你收集整理的iphone – 如何在定制的UITableviewCell中检测到滑动到删除的手势?全部内容,希望文章能够帮你解决iphone – 如何在定制的UITableviewCell中检测到滑动到删除的手势?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。