Closed Songsayit closed 7 years ago
(UIView )tableView:(UITableView )tableView viewForFooterInSection:(NSInteger)section { static NSString IdentifierFooterView = @"footerView"; UITableViewHeaderFooterView headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:IdentifierFooterView]; if (headerView == nil) { headerView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:IdentifierFooterView]; UILabel *titleLabel = [UILabel new];
titleLabel.sd_layout.centerXEqualToView(self.view).heightIs(60.0f).minWidthIs(100); titleLabel.textColor = [UIColor purpleColor]; titleLabel.tag = 100; titleLabel.text = @"test"; titleLabel.layer.borderWidth = 2; titleLabel.layer.borderColor = [[UIColor blueColor] CGColor]; NSLog(@"rect = %@", NSStringFromCGRect([titleLabel frame])); [headerView addSubview:titleLabel];
}
headerView.layer.borderColor = [[UIColor redColor] CGColor]; headerView.layer.borderWidth = 10;
return headerView; }
我本意是想让改label居中显示. 可以测试发现显示不出来. 我在您的demo里没有找到自定义header或者footer类似的用法.
看下demo5
(UIView )tableView:(UITableView )tableView viewForFooterInSection:(NSInteger)section { static NSString IdentifierFooterView = @"footerView"; UITableViewHeaderFooterView headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:IdentifierFooterView]; if (headerView == nil) { headerView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:IdentifierFooterView]; UILabel *titleLabel = [UILabel new];
}
headerView.layer.borderColor = [[UIColor redColor] CGColor]; headerView.layer.borderWidth = 10;
return headerView; }
我本意是想让改label居中显示. 可以测试发现显示不出来. 我在您的demo里没有找到自定义header或者footer类似的用法.