【发布时间】:2018-04-20 14:40:08
【问题描述】:
大家好,在我的 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);
}
}
【问题讨论】:
标签: ios objective-c uitableview uiview uiscrollview