// 自定义 cell
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *identifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease] ;
//自定义 cell的背景
UIImageView *backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, cell.width, cell.height)];
[backImageView setImage:[UIImage imageNamed:@"tck_on3.png"]];
backImageView.tag = 201;
cell.selectedBackgroundView = backImageView;
[backImageView release];
// 自定义评分Label
UILabel *RatingLabel = [[UILabel alloc] initWithFrame:CGRectMake(160, 0, 40, cell.height)];
RatingLabel.text = @"";
RatingLabel.textColor = [UIColor whiteColor];
RatingLabel.backgroundColor = [UIColor clearColor];
RatingLabel.font = [UIFont systemFontOfSize:14];
RatingLabel.tag = 202;
[cell.contentView addSubview:RatingLabel];
[RatingLabel release];
}
// 获得评分 label
UILabel *label = (UILabel *) [self viewWithTag:202];
label.text = [[self.data objectAtIndex:indexPath.row] objectForKey:@"rating"];
// 电影名称
cell.textLabel.text = [[self.data objectAtIndex:indexPath.row] objectForKey:@"title"];
cell.textLabel.textColor = [UIColor whiteColor];
cell.textLabel.font = [UIFont systemFontOfSize:14];
cell.textLabel.highlightedTextColor = [UIColor blackColor];
return cell;
}