들여 쓰기 수준에서 표시되도록 크기를 조정하는 UITableViewCell 파생 클래스를 만들었습니다. 나는하여 ViewControllers의 cellForRowAtIndexPath에서 다음을 사용하여 indentationLevel 및 indentationWidth 설정을 시도했다 : 셀을 들여하지 않습니다 자체크기 조정 UITableViewCell
cell.indentationLevel = [[item objectForKey:@"indent"] intValue];
cell.indentationWidth = CELL_INDENT_SIZE;
이를, 그래서있는 UITableViewCell에 다음 layoutSubviews을 사용하고 있습니다 :
-(void)layoutSubviews {
CGFloat indentSize = (self.indentationLevel - 1) * self.indentationWidth;
CGRect r = containerView.frame;
containerView.frame = CGRectMake (r.origin.x + indentSize, r.origin.y, r.size.width - indentSize, r.size.height);
DLog(@"frameRect : %f, %f, %f, %f, %f",indentSize, r.origin.x, r.origin.y, r.size.width, r.size.height);
[super layoutSubviews];
}
이를 초기 레이아웃에서는 잘 작동하지만 셀을 선택하면 새 치수에서 자체를 다시 계산하고 셀을 선택할 때마다 효과적으로 축소합니다.
어떻게이 셀의 크기를 조정하여 레이아웃을 변경하지 않을 수 있습니까?
기본 들여 쓰기가 왜 작동하지 않습니까? 나는 그것이 더 중요 할 것이라고 생각한다. – TechZen