如果你的界面中含有collectionView懂鸵,需要在viewDidLoad里加上下面這段代碼沛婴,這樣系統(tǒng)就會(huì)按咱們寫的布局來布局控件啦,
if (@available(iOS 11.0, *)) {
? ? ? ? self.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;//UIScrollView也適用
? ? }else {
?? ? ? ?self.automaticallyAdjustsScrollViewInsets = NO;
? ? }
下面是iOS11 中UITableView組頭高度問題解決辦法乏悄,
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
? ? ? ? return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
? ? return 0.1;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
? ? return [UIView new];
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
? ? return [UIView new];
}