繁体   English   中英

静态UITableView中的可滑动单元格

[英]Swipable Cell in static UITableView

我有一个静态UITableView (在情节UITableView创建),其中包含固定数量的部分和单元格。 现在,我想使一个特定的单元格可滑动。 我不想删除该行,我只想显示一个打印按钮,在非静态UITableView滑动单元格时,通常是删除按钮。

如何使我的静态UITableView一个单元格完全可滑动?

您可以在单元格顶部添加UISwipeGestureRecognizer

//The setup code (in viewDidLoad in your view controller)
UISwipeGestureRecognizer *swipeGesture = 
  [[UISwipeGestureRecognizer alloc] initWithTarget:self 
                                          action:@selector(handleSingleTap:)];
[cell addGestureRecognizer:swipeGesture];

//The event handling method
- (void)handleSingleTap:(UISwipeGestureRecognizer *)recognizer {
  CGPoint location = [recognizer locationInView:[recognizer.view superview]];

  //Do stuff here...
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM