问:UITableView scrollview委托方法没有传递特殊代码

时间:2016-07-29 09:40:16

标签: ios uitableview uiscrollview

scrollViewDidScroll:方法中,没有传递特殊代码: 我想淡出显示我的自定义navigationbaralphauiview 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:^{


                }];*/
            }
        }

    }

0 个答案:

没有答案