iOS 视图滚动到某一个位置做某一件事

来源:互联网 发布:内网映射软件 编辑:程序博客网 时间:2024/05/21 09:09

#pragma UIScrollView

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{

    if ([[UIDevicecurrentDevice] userInterfaceIdiom] ==UIUserInterfaceIdiomPhone) {

        return (interfaceOrientation !=UIInterfaceOrientationPortraitUpsideDown);

    } else {

        returnYES;

    }

}


//隐藏导航栏的方法

-(void)scrollViewDidScroll:(UIScrollView *)scrollView{

    

    NSLog(@"scrollViewDidScroll---->%f",self.myTableView.contentOffset.y);

   

    if (self.myTableView.contentOffset.y >=171)

    {

        self.addNavBar.hidden =YES;

        NSLog(@"隐藏导航栏");

    }

    if (self.myTableView.contentOffset.y <=171) {

       

    }

    

}