[英]Remove view on top or bottom of Uitableview hosted on Uitableviewcontroller?
I am currently trying to remove the top or bottom view from my tableview but the size of the whole tableview isnt just right. 我目前正在尝试从表视图中删除顶视图或底视图,但整个表视图的大小并不恰到好处。 Here is what i did so far. 这是我到目前为止所做的。
-(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if(foo){ [self.topView setHidden:YES]; // or [self.topView removeFromSuperview]; // or [self.topView setFrame:CGRectMake(0, 0, 0, 0)]; } }
For example if i remove the view from superview the topview isnt available anymore but there is a big gap on top .. how can i remove this top view from my tableview without having this gap ? 例如,如果我从超级视图中删除视图,则顶视图不再可用,但顶部仍然有很大的空隙..如何在没有此间隙的情况下从桌面视图中删除该顶视图?
I put some Screenshots to describe my Problem: 我放了一些截图来描述我的问题:
If you put it inside the tableview it is probably the tableHeaderView. 如果将其放在tableview中,则可能是tableHeaderView。 Try this: 尝试这个:
self.tableView.tableHeaderView = nil;
Should remove the view and update the tableview accordingly. 应该删除该视图并相应地更新tableview。
[self.tableview reloadData]
删除topview后,或者如果您使用自动布局,则可以使用[self.view updateConstraints];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.