在scrollViewDidScroll:
方法中,没有传递特殊代码:
我想淡出显示我的自定义navigationbar
,alpha
,uiview animation
并直接设置alpha = 1
不起作用。
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if(scrollView == _tableview){
currentContentOffset = scrollView.contentOffset.y;
// 0 ~ 358 -20 ~ 338
/*float alpha_of_scroll = (currentOffsetY + 20) / 358.0;
[self setNavAlpha:alpha_of_scroll];
_narBarView.alpha = 1 - alpha_of_scroll;*/
NSLog(@"%f", currentContentOffset);
// up scroll
if (lastContentOffset > currentContentOffset) {
if (currentContentOffset == 250) {
[UIView animateWithDuration:0.3 animations:^{
_lml_cal_view.alpha = 0.0; // this code did not pass
_narBarView.alpha = 1.0; // this code did not pass.
}];
}
}
// down scroll
else {
if (currentContentOffset == 250 ) {
_lml_cal_view.alpha = 1.0; // this code did not pass.
_narBarView.alpha = 0.0; // this code did not pass
/*[UIView animateWithDuration:0.3 animations:^{
}];*/
}
}
}