UITableViewCell的背景

Saved Blog UITableViewCell是一个很常用的View,通常我们都是直接使用它。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @”CellIdentifier”; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (!cell) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier] autorelease]; } cell.textLabel.text = [NSString stringWithFormat:@”Line: %d”, indexPath.row]; return cell; } 得到这个效果: 现在我们给tableViewCell加上点背景色: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @”CellIdentifier”; UITableViewCell […]