objective-c - UItableviewcell 中的按钮

标签 objective-c ios xcode uitableview

我有一个tableview,我必须在其中使用按钮。基于tableViewCell,我必须对不同的单元格执行不同的操作。如何区分单击了哪个单元格的按钮?

最佳答案

您所要做的就是为 UITableViewCell 的 cellforrowatindex 委托(delegate)中的按钮设置一个标签,然后您必须在按钮的操作中检查标签是否相同。

if(((UIButton *)sender).tag==someIntValue)
{
//your statement
}

关于objective-c - UItableviewcell 中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10565261/

相关文章:

iphone - 在界面构建器的 UILabel 中使用本地化文本?

ios - 自动布局约束冲突

ios - 将 json 响应传递给 iOS 中的另一个 View Controller

ios - Firebase 在某些文件上随机抛出 403 "Permission denied"(iOS/Swift)

ios - 连接 println 的混合类型

swift - 如何在 mac os x 应用程序中通过 shell 命令访问文件?

iphone - 如何在 didSelectRowAtIndexPath : method 中找到部分

ios - 遍历 UICollectionView 中的所有单元格

ios - 类变量值未更新

ios - Swift 类添加 "@objc"为什么