UIView로 일부 원형 하위 뷰가있는 tableview를 만들고 싶습니다. UIView의 layer.cornerRadius 및 clipsToBounds를 설정합니다. 그러나 일부 의견은 반올림되지 않습니다. 누가이 문제를 해결하거나 조언을 해 줄 수 있습니까? UITableViewCell의 하위 뷰는 둥글 수 없습니다.
내 코드 :- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString * settCellID = @"settingCellID";
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:settCellID];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:settCellID];
UIView * view = [[UIView alloc] initWithFrame:CGRectMake(100, 10, 20, 20)];
view.layer.cornerRadius = 10;
view.clipsToBounds = 1;
view.layer.rasterizationScale = [UIScreen mainScreen].scale;
view.layer.shouldRasterize = 1;
view.backgroundColor = [UIColor blueColor];
[cell.contentView addSubview:view];
}
return cell;
}
결과 : 당신이 원하는 경우,이 clipsToBound 내부
장치 또는 시뮬레이터에서 발생합니까? – beyowulf
행 높이로 반환하는 값은 무엇입니까? 이 둥근 뷰의 높이보다 크다. –
이 시뮬레이터에서 발생합니까? 시뮬레이터의 고장 가능성이 있습니다. 시뮬레이터 스케일을 100 %로 설정하십시오 (메뉴 : 윈도우 -> 스케일 -> 100 %). – Jeyamahesan