applidium / OverlayContainer

Non-intrusive iOS UI library to implement overlay based interfaces
https://gaetanzanella.github.io/2018-12-17/replicating-apple-maps-overlay
Other
1.15k stars 94 forks source link

Is possible reset the height of the notches after initialized overlaycontainer #18

Closed msk-psp closed 5 years ago

msk-psp commented 5 years ago

I want to adjust the height of the notches when I push a viewcontroller which has a different height with first pushed viewcontroller..

is It possible?

joustava commented 5 years ago

Have a look at OverlayContainerViewControllerDelegate in the code and also check the example with multiple overlays. Especially:

func overlayContainerViewController(_ containerViewController: OverlayContainerViewController,
                                        heightForNotchAt index: Int,
                                        availableSpace: CGFloat) -> CGFloat {
        return notchHeight(at: index, availableSpace: availableSpace)
    }

Is probably a good place to start. You probably need to invalidate the notch settings and make sure that you calculation is based on the currently 'going to be presented' UIViewController you use as content.

gaetanzanella commented 5 years ago

As @joustava said, the notches are independent of your navigation stack. So move the overlay right before pushing your view controller:

overlayController.invalidateNotchHeights()
overlayController.moveOverlay(toNotchAt: 0, animated: true)
overlayNavigationController.push(newViewController, animated: true)

heightForNotchAt will be called at the moveOverlay line. Return your new notch height.

msk-psp commented 5 years ago

Thank you for you guys replies ^^ I will try it

msk-psp commented 5 years ago

I was successfully implemented the function properly because of reference your replies, Thank you guys