lucoceano / Pager

Pager is the simplest and best way to implement sliding view controllers in Swift
MIT License
232 stars 41 forks source link

Crash on pushviewcontroller to pagercontroller #15

Closed anuraagdjain closed 8 years ago

anuraagdjain commented 8 years ago

I'm having a viewcontroller with navigation controller. When I click a button I push to secondviewcontroller which uses PagerController,PagerDataSource. The swiping of tabs works fine here. But when I click < Back in the navigation bar, the app crashes. topLayoutGuide += self.navigationController!.navigationBar.frame.size.height , error is pointed at this location. Log showed up fatal error: unexpectedly found nil while unwrapping an Optional value . frame value becomes zero.

lfarah commented 8 years ago

Hey @anuraagdjain, sorry for the delay. I was able to find the bug and I think I solved the problem. Can you please try to add this on that line?

            if let nav = self.navigationController {
                topLayoutGuide += nav.navigationBar.frame.size.height
            }

Let me know if it works so I can fix that bug on the codesource 😄

anuraagdjain commented 8 years ago

It's perfect. No crashes now. :)