펜촉에서 맞춤 UITableViewCell을 사용합니다. 액세서리 뷰는 Detail Disclosure Indicator입니다. 문제는 액세서리보기 뒤에있는 UITableViewCell의 배경색이 렌더링되지 않는다는 것입니다 (아래 이미지/소스 참조). 모든 단서? 작동하지 않았다UITableViewCell에서 투명 액세서리보기를 얻는 방법? (스크린 샷 포함)
것들 : 또한, 여기에 내가 시도했지만 작동하지 않았다 몇 가지 있습니다
- clearColor
에 액세서리보기의 backgroundColor로 설정 - 셀의에 contentView.opaque 설정 FALSE
- 셀
에 테이블 뷰의 contentView.opaque 설정
alt text http://www.chicknchoke.com/so/IMG_8028.png
-(void)showTablePrep
{
myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 480, 320, 416) style:UITableViewStylePlain];
myTableView.dataSource = self;
myTableView.delegate = self;
myTableView.delaysContentTouches = FALSE;
myTableView.opaque = FALSE;
myTableView.rowHeight = 60;
[UIView beginAnimations:@"SlideUp" context:nil];
[UIView setAnimationDuration:0.3f];
[myTableView setCenter:CGPointMake(myTableView.center.x, myTableView.center.y-436)];
[self.view addSubview:myTableView];
[self.view bringSubviewToFront:myTableView];
[UIView commitAnimations];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
FriendsCell* cell = [tableView dequeueReusableCellWithIdentifier:@"CustomCellID"];
if (cell == nil){
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"FriendsCellView" owner:self options:nil];
cell = (FriendsCell*)[nib objectAtIndex:0];
if(indexPath.row % 2 == 0){
cell.contentView.backgroundColor = [UIColor grayColor];
}else{
cell.contentView.backgroundColor = [UIColor lightGrayColor];
}
cell.accessoryView.backgroundColor = [UIColor clearColor];
cell.contentView.opaque = FALSE;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if(f
riendsCounter > indexPath.row){
cell.titleLabel.text = @"Label";
cell.descLabel.text = @"Description goes here";
}else{
cell.titleLabel.text = @"";
cell.descLabel.text = @"";
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
return cell;
}
을 'UITableView' 드로잉을 커스터마이징하는 것에 대한 정말 멋진 개관은 다음과 같습니다 : http://cocoawithlove.com/2009/04/easy-custom-uitab leview-drawing.html – Alex
나를 위해 일했습니다 : 세포.backgroundView = [[UIView alloc] init]; cell.backgroundView.backgroundColor = [UIColor yellowColor]; – joshaidan
@joshaidan ARC를 사용하지 않는 한 생성 한 뷰를 공개하는 것을 잊지 마십시오. cell.backgroundView = [[[UIView alloc] init] autorelease]; – manicaesar