Я добавил footerview
программно для каждого раздела следующим образом. Я мог видеть footerview
.
Однако, когда я прокручиваю вверх или вниз внизу или вверху таблицы, footerview
накладывается поверх tableviewcells
.
Как я мог отключить его?
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
if(adminOrderElements[section].expanded && [adminOrderElements[section].notes length]>0)
{
return 60;
} else {
return 0;
}
return 60;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView *footer = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 60)];
footer.backgroundColor = [UIColor clearColor];
UILabel *lbl = [[UILabel alloc]initWithFrame:footer.frame];
lbl.backgroundColor = [UIColor clearColor];
lbl.text = @"Your Text";
lbl.textAlignment = NSTextAlignmentCenter;
[footer addSubview:lbl];
return footer;
}
Перед прокруткой
После прокрутки
heightForFooterInSection
? 60 или 0? - person Paulw11   schedule 01.08.2017footerview
, то это60
. если нет, то это0
на основеif(adminOrderElements[section].expanded && [adminOrderElements[section].notes length]>0)
- person casillas   schedule 01.08.2017Order 4
не имеет содержимого для отображения наfooterview
, поэтому нет представления нижнего колонтитула, другими словами, высота равна0
. НоOrder 3
имеет некоторый контент, поэтому высота нижнего колонтитула равна60
, и вы можете увидеть там метку (Your Text
). - person casillas   schedule 01.08.2017footer.backgroundColor = [UIColor clearColor];
доfooter.backgroundColor = [UIColor blueColor];
и протестировать? - person casillas   schedule 01.08.2017footerview
дляeach section
, а не для всегоtableview
. - person casillas   schedule 01.08.2017