0
我想隐藏一个UIView,但目前为止没有任何工作。 UIView位于UITableView的底部,而不是作为一个单元格。这是我到目前为止的尝试:无法完全隐藏UIView
self.viContainerLocation.hidden = YES;
self.viContainerLocation.alpha=0.0;
CGRect Conframe = self.viContainerLocation.frame;
Conframe.size.height = self.view.bounds.size.height;
self.viContainerLocation.frame = Conframe;
self.tableView.translatesAutoresizingMaskIntoConstraints=NO;
__block CGRect frame=self.tableView.frame;
frame.size.height= self.view.frame.size.height-frame.origin.y;
frame.size.width=self.view.frame.size.width;
self.tableView.frame=frame;
viContainerLocation是我试图隐藏的UIView。上面的代码隐藏了UIView中的所有元素,但留下了UIView维度的空白区域。 对于原因,我不明白,viContainerLocation是隐藏的,当我使用此代码:
[UIView transitionWithView:self.viContainerLocation
duration:0.0
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{ }
completion:^(BOOL finish){
__block CGRect frame=self.tableView.frame;
frame.size.height= self.view.frame.size.height-frame.origin.y;
frame.size.width=self.view.frame.size.width;
self.tableView.frame=frame;
}];
但是使用这个代码的空白被显示在几分之一秒的,它看起来并不好。
我该如何让它从一开始就离开?
尽量去除代码 “self.tableView.translatesAutoresizingMaskIntoConstraints = NO;” –
尝试在最后设置'self.viContainerLocation.hidden = YES;'而不是乞求 –