-
给header约束宽度,才能自适应高度
- (void)didMoveToSuperview { [super didMoveToSuperview]; if (self.superview) { UIView *superView = self.superview; self.translatesAutoresizingMaskIntoConstraints = NO; [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:superView attribute:NSLayoutAttributeWidth multiplier:1.0f constant:0.0f].active = YES; [self updateLayout]; } }
-
更新tableview布局,修改完内容后需要调用
- (void)updateLayout { UITableView *tableView = (UITableView *)self.superview; [tableView beginUpdates]; [tableView layoutIfNeeded]; [tableView endUpdates]; }
-
Notifications
You must be signed in to change notification settings - Fork 0
dabenliu/UITableHeaderViewAutoLayout
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
TableHeaderView高度自适应
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
