Closed danielVebman closed 5 years ago
For now no way change height after presentation. But I am try do it in next version. Many users ask about it.
Do you expect to add it sometime soon, or is might there be some kind of maybe imperfect workaround for the meantime? I would love to use your beautifully done framework in the app I’m currently developing.
Now I am develop it for my app Debt: https://itunes.apple.com/app/id1446635818
For start I am added dynamic height in app.
That looks very good! When do you expect to merge your enhancement with the main SPLarkController branch?
I am try do it in ‘June’.
Awesome I’ll keep an eye out!
Hi! Do you have any estimate as to when the enhancement might be ready?
I did the enhancement myself and published it in my repository, here. The change is actually quite simple. In SPLarkPresentationController
, I added:
/// update the current height of the controller
public func updateHeight(_ newHeight: CGFloat) {
guard let containerView = containerView else { return }
UIView.animate(
withDuration: 0.45,
delay: 0,
usingSpringWithDamping: 1,
initialSpringVelocity: 1,
options: [.curveEaseOut, .allowUserInteraction],
animations: {
self.presentedView?.frame.origin.y = containerView.frame.height - newHeight
self.presentedView?.frame.size.height = newHeight
self.snapshotViewContainer.transform = CGAffineTransform(translationX: 0, y: -newHeight)
}
) { _ in
// I simplified `self.height` into a { get set } variable that basically keeps track of state
self.height = newHeight
}
}
The version in my repository also contains some other simplifications (although the access control is nonexistent).
@danielVebman you can create simple project with changeable height and send me for test?
@ivanvorobei, I added a very simple sample project here.
@danielVebman thanks for your research and time!
You do cool job! I am added changeable height in new version 1.1
.
Also I am added example project.
I now seem to understand what I had to offer to make you a PR, sorry if this was important to you.
Many thanks!
Although this is not part of the current implementation, would you have any suggestions on how to change the view controller's height after it has been presented?
An example use case for this behavior would be a settings view controller with a textfield which moves up when the keyboard appears.