[英]How to get label value in table view cell on button click in cell
I have a prototype cell which with a button and a label in it. 我有一个带有按钮和标签的原型单元。 The text of the label changes for each cell. 标签的文本随每个单元格而变化。 I have set up an @IBAction
for the button and would like to get the text for the label in the cell in which the button in pressed. 我为按钮设置了一个@IBAction
,并希望在按下按钮的单元格中获取标签的文本。 Does anyone know how to do this? 有谁知道如何做到这一点?
I hope it will help you. 希望对您有帮助。
- (IBAction)buttonHandler:(id)sender{
UIButton *button = (UIButton *)sender;
UITableViewCell *cell = (UITableViewCell *)button.superview;
println("%@",cell.textLabel.text)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.