gpt4 book ai didi

ios - 静态 UITableView 中的可滑动单元格

转载 作者:行者123 更新时间:2023-11-28 20:01:46 25 4
gpt4 key购买 nike

我有一个静态的 UITableView(在 Storyboard 中创建),其中包含固定数量的部分和单元格。现在,我想让一个特定的单元格可滑动。我不想删除该行,我只想在非静态 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...
}

关于ios - 静态 UITableView 中的可滑动单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23719211/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com