jakespracher / Snapchat-Swipe-View

Handy four way snapchat style scrolling navigation
MIT License
143 stars 19 forks source link

Unwind from a presented view controller results in a blank 'black screen' #9

Open senabhishek opened 8 years ago

senabhishek commented 8 years ago

This is the code in my AppDelegate:

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let middle = storyboard.instantiateViewController(withIdentifier: "DashboardStoryboardVC")
    let top = storyboard.instantiateViewController(withIdentifier: "CashoutStoryboardVC")
    let bottom = storyboard.instantiateViewController(withIdentifier: "AnalyticsStoryboardVC")
    let snapContainer = SnapContainerViewController.containerViewWith(nil,
                                                                      middleVC: middle,
                                                                      rightVC: nil,
                                                                      topVC: top,
                                                                      bottomVC: bottom)
    self.window?.rootViewController = snapContainer
    self.window?.makeKeyAndVisible()

I have modified your SnapContainerViewController to make the left and right as optional and top and bottom as mandatory view controllers. Now when I present a view controller via a segue from the middle view controller, after dismissing it through either an unwind segue or even a dismiss(), I get back a black blank screen.

I checked the rootViewController and see that it is still set to the snapContainer viewController as shown in the code above. Can you tell me what I'm doing wrong?

jakespracher commented 7 years ago

Ah, so it sounds like you want to present some other viewcontroller that is not part of the top/down/left/right scheme. Yeah its a pain, if you look at how the snapchat behaves, you'll notice that when they do this (e.g. in settings) the transitions don't exhibit UINavigationController behavior. They have their own custom navigation transitions going on. For the app I used this in I ended up doing that stuff custom. As a simple example, you could have the view you want to switch to offscreen and slide it on screen on a button press. You could also follow this

https://www.objc.io/issues/12-animations/custom-container-view-controller-transitions/