我正在寻找如何在其上移动视图来实现表格视图的想法。
所以这个想法与facebook app中的navBar类似。当您向上滚动时,此(红色)视图向上移动并隐藏,当您向上滚动并向下滚动其显示时。这不是导航栏,因此我发现的大多数吊舱都不能在这种情况下工作。这也不能是tableView标头或节头。
答案 0 :(得分:0)
您需要在表格上方添加此视图:
[self.tableView.superview insertSubview:view aboveSubview:self.tableView]
或者你可以在故事板中完成。 当你向下滚动隐藏视图时,向上显示。
[view setHidden:YES];
此外,您可以将表格插图更改为超级视图的顶部。
self.tableView.contentInset = self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(self.tableView.contentInset.top -, self.tableView.contentInset.left, self.tableView.contentInset.bottom, self.tableView.contentInset.right);
答案 1 :(得分:0)
看看这个库,它完全符合您的要求
答案 2 :(得分:0)
我认为使用手势识别器识别隐藏和隐藏动作的快速方法可以使用以下方法,
[UIView animateWithDuration:0.5 animations:^{
[attachedView setAlpha:0.0f];
} completion:^(BOOL finished) {
[attachedView setHidden:YES];
}];
并显示附加视图
[UIView animateWithDuration:0.5 animations:^{
[attachedView setAlpha:1.0f];
} completion:^(BOOL finished) {
[attachedView setHidden:YES];
}];
方法可以帮助您轻柔地隐藏和显示视图。