给所有的UITableViewCell 背景图片设置成同样的,代码:
- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"SelectAnAlbumTableViewCellBackground"]] autorelease];
}
对其中一些有效,但是对是空的cell就无效。不知道怎么样可以对所以的背景设置同样的图片?
首先,设置cell的backgroundView 放到函数
-(void)tableView:(UITableView *)tableView cellForRowAtIndex:(NSIndexPath *) indexPath
中来处理比较好点.
再者,对于空的cell是不会被调用 cellForRowAtIndexPath: or willDisplayCell: 消息的.所以你设置backgroundview的方法也就起不到作用.