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