Hide NavigationBar when scrolling tableView in CollectionView?

前端 未结 6 1604
一整个雨季
一整个雨季 2020-12-05 11:47

I have collectionViewController and collectionViewCell include TableView.CollectionView is horizontal layout.I want hide navigationbar when scroll the tableView. Is there an

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 12:16

    You can use some git libraries for scrollable Navigation bar whenever you want to scroll your table view/ Scroll top to bottom / bottom to top it will automatically adjust you Navigation bar.

    you can use here like this code for use this library like this

    Swift

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
    
        if let navigationController = self.navigationController as? ScrollingNavigationController {
            navigationController.followScrollView(tableView, delay: 50.0)
        }
    }
    

    Objective - C

    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
    
        [(ScrollingNavigationController *)self.navigationController followScrollView:self.tableView delay:50.0f];
    }
    

    It having some delegate methods help for manage all this related to scroll and navigation.

    AMScrollingNavbar click here for see

    I think this is helpful for you.

提交回复
热议问题