dimanche 19 juin 2016

Hiccups while hiding and showing NavigationBar on tableView

i am trying to hide my tableView's navigationBar with this on my ScrollViewDidScroll

    print("tableView is Scrolling :  (scrollView.contentOffset.y)")

    let headerView = self.tableView.tableHeaderView as! HeaderView
    headerView.scrollViewDidScroll(scrollView)

    if scrollView.contentOffset.y  >= self.view.frame.size.height/3.4 {

        self.navigationController?.setNavigationBarHidden(false, animated: true)

    }  else if scrollView.contentOffset.y  < self.view.frame.size.height/3.4 {

        self.navigationController?.setNavigationBarHidden(true, animated: true)
    }

but while hiding my navigationBar its smoothly working but when am showing it my tableView is shaking (having hiccups)

below is my ContentOffSet while showing the NavigationBar:

tableView is Scrolling :  3.5
tableView is Scrolling :  8.5
tableView is Scrolling :  14.0
tableView is Scrolling :  20.0
tableView is Scrolling :  26.0
.
.
.
.
.  //scrolling smoothly 
.
.
tableView is Scrolling :  191.0
tableView is Scrolling :  192.0
tableView is Scrolling :  192.5
tableView is Scrolling :  193.0
tableView is Scrolling :  194.0
tableView is Scrolling :  195.0
tableView is Scrolling :  195.5
tableView is Scrolling :  196.5
tableView is Scrolling :  152.0 // you can see the hiccups right here 
tableView is Scrolling :  152.0 // you can see the hiccups right here 
tableView is Scrolling :  196.0
tableView is Scrolling :  196.0
tableView is Scrolling :  197.0
tableView is Scrolling :  153.0
tableView is Scrolling :  153.0
tableView is Scrolling :  197.0
tableView is Scrolling :  197.0 
tableView is Scrolling :  153.0 // you can see the hiccups right here 
tableView is Scrolling :  153.0 // contentOffset changed from 197.0 to 153.0 with a shaking effect 
tableView is Scrolling :  197.0
tableView is Scrolling :  197.0
tableView is Scrolling :  198.0
tableView is Scrolling :  199.0
tableView is Scrolling :  200.0
tableView is Scrolling :  201.0

any one knows why its happening or how to fix this ??

Aucun commentaire:

Enregistrer un commentaire