【发布时间】:2012-07-31 09:37:51
【问题描述】:
我想将标签子视图添加到 UITableViewCell。我可以轻松地将框架原点和大小设置为特定值,但如何使用当前/默认单元格标签高度和位置?
UILabel *labPerHour;
cell.textLabel.text = @"Rate";
labPerHour = [[UILabel alloc] init];
//labPerHour.frame = CGRectMake( 280, cell.textLabel.frame.origin.y, 80, cell.textLabel.frame.size.height );
labPerHour.frame = CGRectMake( 260, 7, 30, 30 );
labPerHour.text = @"$/hr";
[cell addSubview:labPerHour];
我希望注释掉的行可以工作..或类似的东西。
有人可以帮忙吗?这段代码当然是我的 cellForRowAtIndexPath 方法的一部分。
【问题讨论】:
-
您是否使用 ios5 故事板功能创建了原型单元?
-
不,我仍在使用 Xcode 4。谢谢。
标签: iphone objective-c ios uitableview uilabel