0
사용자 정의 UITableViewCell
을 가지고 있으며 구분 기호의 삽입을 들여 쓰지 않고 UITextLabel
을 들여 쓰고 싶습니다.사용자 정의 UITableViewCell에 들여 쓰기 UITextLabel
다음을 시도했지만 결과를 얻지 못했습니다. 이것을 어떻게 할 수 있습니까? UITableViewCell이 사용하는 자동 레이아웃을 편집 할 수 있습니까? 또는 내 자신의 UITextLabel
을 만들어야합니까?
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
if (self) {
...
self.separatorInset = UIEdgeInsetsZero;
self.layoutMargins = UIEdgeInsetsZero;
...
self.textLabel.layoutMargins = UIEdgeInsetsMake(self.textLabel.layoutMargins.top,
self.textLabel.layoutMargins.left + 30,
self.textLabel.layoutMargins.bottom,
self.textLabel.layoutMargins.right);
}
return self;
}
고마워요!
당신은 IBOutlet''에 제약을 연결할 수 있습니다. 왜 사용자 정의 셀의 왼쪽 여백 제약 조건을 드러내고 제약 조건의 배율을 설정하면 들여 쓰기 lv 1에 배수 = 1이 있고 lv 2에 배율 = 2가 설정됩니다. – sikhapol
@SikhapolSaijit InterfaceBuilder를 사용하지 않습니다. – Joseph