0

I use a tableView(named tableViewTwo) as other tableView.talbeHeaderView

The tableViewTwo cant scroll

Why and What can I do

UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 12)];
view1.backgroundColor = GL_TABLEVIEW_BACKGROUD_COLOR;

UIView *tableHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, CGRectGetMaxY(self.lineGroupView.frame))];
tableHeaderView.backgroundColor = [UIColor whiteColor];

[tableHeaderView addSubview:view1];
[tableHeaderView addSubview:self.candleTopV];
[tableHeaderView addSubview:self.lineGroupView];//it is a tableview
tableView.tableHeaderView = tableHeaderView;

the code : github: https://github.com/CoderYLZhang/tableHeaderViewTest

CoderYL
  • 85
  • 7
  • Perhaps not an answer so I'm not posting as one, but I would STRONGLY encourage you to rethink this. This is not the intended use of a `UITableView` and it will behave unexpectedly (such as the scroll issue). My advice to you would be to utilise table sections and stick the the one table view but add an additional section for the content you want to display in the header table. – Jacob King Dec 20 '16 at 08:45
  • And you expect, that tableview will scrollable ? – Jitendra Modi Dec 20 '16 at 08:57
  • I can make you tableview as your headerview but not scrollable. I will make your whole tableview as headerview – Jitendra Modi Dec 20 '16 at 09:01
  • I hope two can scrollable,and i sent some code to github; the code : github: https://github.com/CoderYLZhang/tableHeaderViewTest @Jecky – CoderYL Dec 20 '16 at 11:44
  • @CoderYL tabletwo is not scrollable but I can set you whole tableview according your expectations – Jitendra Modi Dec 20 '16 at 12:04
  • @Jecky YES,the tableViewTwo is not scrollable,but other tableView can, i hope both of them can scroll, you have any proposal? – CoderYL Dec 20 '16 at 15:52
  • yes, except tableviewTwo all other tableview are scrollable. I can make you a demo today and let you know @CoderYL – Jitendra Modi Dec 21 '16 at 04:48

0 Answers0