ivanvorobei / SPLarkController

Custom transition between controllers. Settings controller for your iOS app.
https://opensource.ivanvorobei.io
MIT License
988 stars 47 forks source link

Custom height for Lark presenter doesn't actually make the sub VC same height as custom height #3

Closed Kohdepitcher closed 5 years ago

Kohdepitcher commented 5 years ago

Hi, been trying to use this library to present one of my own custom VCs but I can't work out why the height of the presented view controller using lark doesn't have the same height as the custom height provided to the transition delegate. For example, ive told the delegate to be half the screen size which works for the transition but the view controller that is presented is still the same height as the screen height. This means that any views pinned to the bottom of the safe area for example are missing when using Lark.

in this screen shot, you can see that the pink button is cut off even though it is constrained to be centre vertical and centre horizontal. IMG_1852

Is there anyway to force the presented view controller's frame to match the frame of the lark transition? I've tried messing with the code in the library and can't seem to get it to work. I've noticed that frameOfPresentedViewInContainerView method never gets called in the presentation controller. override var frameOfPresentedViewInContainerView: CGRect { guard let containerView = containerView else { return .zero } print("frameOfPresentedViewInContainerView") return CGRect(x: 0, y: containerView.bounds.height - self.height, width: containerView.bounds.width, height: self.height) }

Kohdepitcher commented 5 years ago

Solved the issue by modifying the following line in the LarkPresentationController override var frameOfPresentedViewInContainerView: CGRect { guard let containerView = containerView else { return .zero } return CGRect(x: 0, y: containerView.bounds.height - self.height, width: containerView.bounds.width, height: containerView.bounds.height) }

to this override var frameOfPresentedViewInContainerView: CGRect { guard let containerView = containerView else { return .zero } return CGRect(x: 0, y: containerView.bounds.height - self.height, width: containerView.bounds.width, height: self.height) }

This will make the presented controller using the lark transition to be the same height as the default height or custom height.

ivanvorobei commented 5 years ago

Thanks for your research. If you want, you can create Pull Request for Source folder. Or I can do it.

ivanvorobei commented 5 years ago

@Kohdepitcher thanks for pull request. I am publish new version 1.0.9, please, update.