我的应用包含一个 UITableView
,它有部分页脚。当用户滚动到 tableView 的底部时,有时最后一个单元格和 tableFooter 之间会出现分隔符插图。这种行为是不一致的。
有没有办法强制这个分隔符总是出现或从不出现?你们中有人注意到同样的不一致行为吗?对我来说似乎是个错误。
编辑
我正在使用
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UILabel *footer = [[UILabel alloc] init];
footer.backgroundColor = [UIColor whiteColor];
footer.font = [footer.font fontWithSize:15];
footer.textAlignment = NSTextAlignmentCenter;
return footer;
}
但你可以很容易地重现同样的问题只使用
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;
最佳答案
为此,您必须覆盖用作页脚的标准 UIView
。
您可以通过覆盖委托(delegate)方法 -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
来做到这一点。
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView *myFooterView;
// create a view with a label and without a line at the top etc...
return myFooterView;
}
关于ios - UITableView 底部分隔符插图 - IOS 7 中的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22612570/