I want to setup 2 completely different look(and content) of a cell. (one selected, and one not selected).
该法典是BUT的,因为选定电池的图像是50%的透明性,因此,我可以看到底层的背景意见。
显然,选定 背景 观点提供了一种独一无二的方法,在选择时只见到一个单元。 是否还有其他地点,而不是有人对居民区进行背景观察,在选定的BackgroundView上不会出现这样的地点。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = @"hello";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
}
UIImage *image = [UIImage imageNamed:@"listview_btn.png"];
UIImage *imageThumb = [UIImage imageNamed:@"01_thumb.jpg"];
UIImageView* imageView = [[UIImageView alloc] initWithImage:imageThumb];
[imageView setFrame:CGRectMake(0, 0, 50, 67)];
[cell setBackgroundView:[[UIImageView alloc]initWithImage:image] ];
[cell.backgroundView addSubview:imageView];
UIImage *imageSel = [UIImage imageNamed:@"listview_btn_on.png"];
UIImage *imageThumbSel = [UIImage imageNamed:@"01_thumb_Sel.jpg"];
UIImageView* imageViewSel = [[UIImageView alloc] initWithImage:imageThumbSel];
[imageViewSel setFrame:CGRectMake(110, 0, 50, 67)];
[cell setSelectedBackgroundView:[[UIImageView alloc]initWithImage:imageSel] ];
[cell.selectedBackgroundView addSubview:imageViewSel];