【发布时间】:2014-07-06 16:55:50
【问题描述】:
在每个uitableview单元格中,有一个按钮,一个uilabel,如以下代码
ListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[ListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
[cell.UIButton addTarget:self action:@selector(ButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
cell.UIButton.tag = indexPath.row;
cell.UILabel.text = @"0";
我想要这个,当我点击按钮时,与uibutton在同一单元格的uilabel.text会添加一个,我再次点击,uilabel.text会添加一个,就像投票一样。
- (IBAction)ButtonClicked:(UIButton *)sender
{
NSInteger selectedRow = sender.tag;
}
那么如何更改 uilabel 的文本?谢谢。
【问题讨论】:
-
请阅读developer.apple.com/library/mac/documentation/Cocoa/Conceptual/…并相应地重命名您的变量和方法,以便我们更轻松地帮助您解决问题。
-
@duci9y 感谢您的建议。
标签: ios objective-c uitableview uibutton uilabel