单元格宽度在静态UITableView
问题描述:
我在我的应用程序中使用具有静态表视图作为选项面板的UITableViewController。我有一个背景图像,显示了一个圆形的边框面板,我想将静态单元格放在此图像中。不幸的是,它看起来不可能设置单元格宽度,并且表格试图获得尽可能多的空间。单元格宽度在静态UITableView
我该如何解决?
非常感谢
克劳斯
答
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
//cell background image
UIImageView *backgroundView = [[UIImageView alloc] initWithFrame:CGRectZero];
cell.backgroundView = backgroundView;
backgroundView.image = [UIImage imageNamed:@"backgroundimage.png"];
return cell;
}