Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide and Show the BottomView - pullupController.reloadData()? #48

Closed
andre991 opened this issue May 26, 2017 · 3 comments
Closed

Hide and Show the BottomView - pullupController.reloadData()? #48

andre991 opened this issue May 26, 2017 · 3 comments

Comments

@andre991
Copy link

Hi, firstly congratulations, this framework is awesome.Please, I have some doubts:

1 - How can I show bottom view only after pressed an button and hide after pressed another button, if is possible?

2- How can I update the view so that it can go through the delegates again(same tableView.reloadData())?

Thanks.

@shagedorn
Copy link
Contributor

Thanks for your kind words.

  1. Hiding the bottom view

The easiest way is to lock/collapse the bottom controller, and in your bottom view controller, adjust the minimum height in that case (unless you are using the lock state for other purposes, in which case you may introduce another state property). You can try this in the sample project.

Add this code to ViewController.commonInit():

DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
    // lock/hide the bottom after 3 seconds
    self.isLocked = true
    self.setState(.collapsed, animated: true)

    DispatchQueue.main.asyncAfter(deadline: .now() + 3, execute: { 
        // unlock/show it again after another 3 seconds
        self.isLocked = false
        self.setState(.collapsed, animated:true)
    })
}

In the BottomVC, change this piece of code:

func pullUpViewController(_ pullUpViewController: ISHPullUpViewController, minimumHeightForBottomViewController bottomVC: UIViewController) -> CGFloat {
    // if locked, hide it completely
    return pullUpViewController.isLocked ? 0.0 : topView.systemLayoutSizeFitting(UILayoutFittingCompressedSize).height;
}
  1. Assuming you are referring to the sizing delegate, calling invalidateLayout on the pull up controller should do. Alternatively, change the state, as done in the example above.

@andre991
Copy link
Author

andre991 commented Jun 1, 2017

Thanks sharedorn, I will try. :)

@shagedorn
Copy link
Contributor

Will close for now. Feel free to reopen in case something remains unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants