2013-06-11 47 views

回答

0

在的tableView数据源的方法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

你可以这样做:

UIImageView * imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image_background.png"]]; 
cell.selectedBackgroundView = imageView; 

当选中单元格时,其背景设置为imageView

+0

使用'

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { cell.backgroundColor = [UIColor redColor]; } 

我知道如何做到以上.....但我想图像重叠整个单元格,并且其宽度比整个单元格更大 – Jatin

+0

请参阅上面的编辑..附图 – Jatin

0

如果你不使用任何背景图片为您UITableViewCell比使用delegate method of的UITableView:如果您使用的背景图片为您UITableViewCellcellForRowAtIndexPath:

UIImageView *selBGView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"urimage.png"]]; 
cell.selectedBackgroundView = selBGView; 
+0

请参阅我的编辑以上.. .. ge附上 – Jatin

相关问题