Tag: tablefooterview

UITableView tableFooterView显示在UITableView的顶部 – 错误

我创build了一个非常简单的testing用例来重现这个问题。 我想以编程方式设置页脚视图到一个tableview。 请注意,我指的是在tableview的底部页脚 – 不是部分页脚(大多数堆栈溢出的答案混淆了他们)。 这是我非常简单的代码: – (void)viewDidLoad { [super viewDidLoad]; UIView *footerContainer = [[UIView alloc] initWithFrame:CGRectZero]; footerContainer.backgroundColor=[UIColor greenColor]; footerContainer.translatesAutoresizingMaskIntoConstraints=NO; [footerContainer addConstraints:@[[NSLayoutConstraint constraintWithItem:footerContainer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:100 ], [NSLayoutConstraint constraintWithItem:footerContainer attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:[UIScreen mainScreen].bounds.size.width ]]]; self.mytableview.tableFooterView=footerContainer; [self.view setNeedsLayout]; [self.view layoutIfNeeded]; } – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 10; } – (UITableViewCell […]