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];
}
}