![](/img/trans.png)
[英]ios - How to get label value from table cell by click button in table cell?
[英]How to get label value in table view cell on button click in cell
我有一個帶有按鈕和標簽的原型單元。 標簽的文本隨每個單元格而變化。 我為按鈕設置了一個@IBAction
,並希望在按下按鈕的單元格中獲取標簽的文本。 有誰知道如何做到這一點?
希望對您有幫助。
- (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.