【问题标题】:how to set the array of text position in cell in UITableview in iphone如何在iphone的UITableview中设置单元格中的文本位置数组
【发布时间】:2013-11-28 11:21:09
【问题描述】:

我有一个可变数组。我想在 UITableView 中设置文本的框架。

if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [appDelegate.UnitTypeAry objectAtIndex:indexPath.row];
cell.textLabel.frame = CGRectMake(10, 10, 150, 40);

【问题讨论】:

  • 要么创建自定义 UILabel 并添加到 cell.contentView 中,要么覆盖 layoutSubviews 如this
  • 是的...我要添加数组文本的框架

标签: ios iphone uitableview ios5 nsmutablearray


【解决方案1】:

您需要实现一个继承 UITableViewCell 的新类,并在单元格的 contentView 属性中添加标签。

更改标签的框架

-(void)layoutSubviews
{

}

你的新 Cell Class

【讨论】:

  • 我有 UITableViewController 而不是 UITableViewCell
  • @AayushiPanchal 您需要创建一个继承 UITableViewCell 的新类并在其中进行自定义工作,然后您可以使用它来代替 UITableViewCell。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-10-01
  • 2023-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-02
相关资源
最近更新 更多