Open santi-g-s opened 5 years ago
Here is what it should look like when it starts:
This is what I get
It is really hard to understand the issue here.
My guess here is that you are calling the method addPullUpController(<#T##PullUpController#>, initialStickyPointOffset: <#T##CGFloat#>, animated: <#T##Bool#>)
using a wrong value as initialStickyPointOffset
or when your view's layout is not ready.
Could you please provide an example of the issue using the demo project?
Here's the code I use to make the pullUpController.
private func makeViewController() -> ViewController {
let currentPullUpController = children
.filter({ $0 is ViewController })
.first as? ViewController
let pullUpController: ViewController = currentPullUpController ?? UIStoryboard(name: "Main",bundle: nil).instantiateViewController(withIdentifier: "ViewController") as! ViewController
pullUpController.initialState = .contracted
if originalPullUpControllerViewSize == .zero {
originalPullUpControllerViewSize = pullUpController.view.bounds.size
}
return pullUpController
}
I add it to the view with this (had to add 15 so that i can at least see it)
private func addPullUpController() {
let pullUpController = makeViewController()
_ = pullUpController.view
print(pullUpController.initialPointOffset)
addPullUpController(pullUpController,
initialStickyPointOffset: pullUpController.initialPointOffset + 15,
animated: true)
}
The initialPointOffset is set up as follows:
var initialPointOffset: CGFloat {
switch initialState {
case .contracted:
return containerView?.frame.height ?? 0
case .expanded:
return pullUpControllerPreferredSize.height
}
}
And the prefferedSize comes from the portrait Size.
The confusing bit is that this only happens when the app is loaded initially. After that the sticky points are correct.
@santi-g-s navigationBar is the reason
Hi, thanks for the great work you've done. But, when my app initially loads, the view is shown much lower than it should be when collapsed. Once I swipe up to open it, however, it returns to the correct height when collapsed and expanded. I have set the height of the collapsed view to be a view container I have in the PullUpView.