gpt4 book ai didi

ios - 如何在 didTriggerRightUtilityButtonWithIndex 委托(delegate)中获取滑动的单元格索引路径?

转载 作者:行者123 更新时间:2023-11-29 12:22:47 25 4
gpt4 key购买 nike

我已经根据本教程完成了 UITableView 单元格滑动

http://www.appcoda.com/swipeable-uitableviewcell-tutorial/

现在我想获取在该委托(delegate)中滑动的特定单元格的索引路径

- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index

如何获取当前刷过的Cell的indexpath。

最佳答案

您可以通过将 Storyboard 中的 outlet 绑定(bind)到您的 .h 文件来创建您的 TableView 的实例,例如

@interface SwipeTableViewController : UITableViewController <SWTableViewCellDelegate>
@property (strong, nonatomic) IBOutlet UITableView *yourTableView;

@end

在相同的方法中,您可以借助方法的单元格实例获取NSIndexPath

- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index {
NSIndexPath *indexPath = [self.yourTableView indexPathForCell:cell];
NSLog(@"%i",indexPath.row);
....
}

希望对你有帮助。

关于ios - 如何在 didTriggerRightUtilityButtonWithIndex 委托(delegate)中获取滑动的单元格索引路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30115341/

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