인터페이스 디자이너는 매우 간단한 설정을 사용합니다. 기본보기 (표 셀보기)에는 네 개의 하위보기 인 모든 형제 인 UIImageView
과 세 개의 UILabel
이 있습니다. UIImageView를 사용하여 테이블 행의 배경을 표시합니다. UIImageView가 Z- 인덱스 트리의 맨 뒤에 있고 알파를 0.2로 설정하여 이미지를 어둡게 설정했습니다. UILabel이이를 처리합니다.UIImageView z- 인덱스 문제
인터페이스 디자이너의 디자인 타임에 이미지를 imageview로 설정하면 모든 것이 잘되지만 디자인 타임에 이미지를 이미지 뷰로 설정하면 (서버에서 실제 이미지를 받음) 이미지 뷰 알파 설정이 무시되면 이미지는 알파 = 1로 표시되고 uiimageview는 모든 레이블 위에 표시됩니다. 심지어 [parent sendSubviewToBack:imageView]
을 사용하려했지만 도움이되지 않았습니다.
무엇이 누락 되었습니까? 여기에 테이블 행을 표시하는 데 필요한 모든 코드가 있습니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"OOItemInfoCell" owner:self options:nil] lastObject];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
OOXMLNode *infoNode = [searchItemList objectAtIndex:indexPath.row];
[(UILabel *)[cell viewWithTag:2] setText:[itemNode elementNodeWithKey:@"title"].value];
[(UILabel *)[cell viewWithTag:3] setText:[itemNode elementNodeWithKey:@"intro"].value];
[(UILabel *)[cell viewWithTag:4] setText:[NSString stringWithFormat:kThemeAge,
[itemNode elementNodeWithKey:@"theme"].value,
[itemNode elementNodeWithKey:@"age"].value]];
UIImageView *bgview = (UIImageView *)[cell viewWithTag:0];
[bgview setImage:[itemNode imageFromKey:@"background"]];
[cell sendSubviewToBack:bgview];
return cell;
}