iPhone - How to determine in which cell a button was pressed in a custom UITableViewCell

后端 未结 10 1943
遥遥无期
遥遥无期 2021-01-01 15:45

I currently have a UITableView that is populated with a custom UITableViewCell that is in a separate nib. In the cell, there are two buttons that are wired to actions in th

10条回答
  •  青春惊慌失措
    2021-01-01 16:19

    Even easier:

    -(IBAction) buttonPressed {
        NSIndexPath *myIndexPath = [(UITableView *)self.superview indexPathForCell: self];
        // do whatever you need to do with the information
    }
    

提交回复
热议问题