大家好我的 ViewController 我有一个 UIView 放在顶部,一个 UITableView 紧挨着 UITableView
我试图在 UITableview 向上滚动时更改 UIView 的高度
我正在尝试使用此方法,但我无法获得结果。我的 UIView 卡住了......我哪里做错了?
这是使用中的代码
-(void)viewDidLoad {
[super viewDidLoad];
_navView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, self.view.frame.size.width -20, 50)];
_navView.backgroundColor = UIColor.clearColor;
[self.view addSubview:_navView];
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y >50) {
self.navView.frame = CGRectMake(10, 20, self.view.frame.size.width -20, 0);
} else {
self.navView.frame = CGRectMake(10, 20, self.view.frame.size.width -20, 50);
}
}
最佳答案
你必须把 viewDidLoad
放在里面
self.tableView.delegate = self
关于ios - UITableView 滚动时改变 UIView 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49944208/