scrollView要设置代理代理
scrollView.delegate = self;it
//要悬停的viewscroll
UIView * hoverView = [[UIView alloc] initWithFrame:CGRectMake(x, y, width, height)];方法
[scrollView addSubview:logoView];view
// 代理方法vi
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {co
//scrollView 的偏移量大于 ( 悬停view的纵坐标y - 状态栏的高度 STATUS_BAR_HEIGHT )时添加到与scrollView同一层级void
if (scrollView.contentOffset.y > y - STATUS_BAR_HEIGHT) {
hoverView.frame = CGRectMake(0, STATUS_BAR_HEIGHT, width, height);
[self.view addSubview:hoverView];
}else {
hoverView.frame = CGRectMake(0, y, width, height);
[scrollView addSubview:hoverView];
}
}