【发布时间】:2015-08-24 12:48:51
【问题描述】:
我使用下面的代码来更改我的自定义uitableviewcell 标签的文本:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
//NSArray *allsubviews = [[NSBundle mainBundle] loadNibNamed:@"LICustomUI" owner:nil options:nil];
//LIMerchantTableViewCell *cell = [allsubviews objectAtIndex:LIApplicationLayout() == LIApplicationDirectionRightToLeft ? 8 : 9];
let allSubViews = NSBundle.mainBundle().loadNibNamed("LICustomUI", owner: nil, options: nil)
var cell:LIInsuranceNameTableViewCell = allSubViews[11] as! LIInsuranceNameTableViewCell
cell.insuranceName.text = "Hello"
println(cell.insuranceName)
cell.insuranceName.backgroundColor = UIColor.redColor();
// cell.backgroundColor = UIColor.redColor();
return cell
}
println() 日志的结果是:
<UILabel: 0x7ad71930; frame = (0 11; 320 21); text = 'Hello'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7ad71a10>>
但在设备(模拟器)中文本没有改变!
【问题讨论】:
-
您在设备上看到了什么文字?
标签: ios swift uitableview uilabel