1
我正在使用故事板来创建一个静态tableview。 一切正常!自定义静态TableView与故事板 - 单元格背景
现在我想自定义表格视图单元格。
因此,我添加一个tableViewController并将其连接到故事板视图。 这里是我使用自定义代码:
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell...
UIColor *color = [[UIColor alloc] initWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
cell.detailTextLabel.backgroundColor = color;
cell.textLabel.backgroundColor = color;
cell.backgroundView = [ [UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"cellbackground.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0]];
cell.selectedBackgroundView = [ [UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"cellbackground_down.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0]];
return cell;
}
但如果我现在运行应用程序,表视图是空的,没有自定义背景...
一些能帮我吗? :=)
Laurenz