lucoceano / Pager

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

Push view in child VC #21

Closed gorbat-o closed 8 years ago

gorbat-o commented 8 years ago

Hey,

How can i push a view in a child,

I ve got 2 child View Controller with table view in these When i select a row, i cant use my navigation controller of these views, i need to use the super one, which implement Pager,

Can someone found a solution ? Thanks

lfarah commented 8 years ago

I think @nschucky found the answer. Can you please download his fork and see if it works?

Thanks 😄

gorbat-o commented 8 years ago

Nop, it's crashing :/ haha

Thanks to try, so, it's just the Superview who give his instance to child for enable push view maybe ? what do you think of it ?

PS: error:

capture d ecran 2016-08-25 a 15 59 57
2016-08-25 15:59:12.520 Pager[397:71052] Unknown class _TtC5Pager18GreyViewController in Interface Builder file.
2016-08-25 15:59:14.655 Pager[397:71052] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x14e633b90> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tableView.'
*** First throw call stack:
(0x18349edb0 0x182b03f80 0x18349ea70 0x183dab6e4 0x188971de8 0x188ad4eb0 0x1833c2888 0x188ad3898 0x188975230 0x18873a118 0x1885fc8ec 0x1885fc844 0x188d86500 0x188d8672c 0x10008d900 0x10008cdfc 0x1006b5a7c 0x1006b5a3c 0x1006bb4e4 0x183454d50 0x183452bb8 0x18337cc50 0x184c64088 0x188666088 0x100078938 0x182f1a8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
nsleche commented 8 years ago

@gorbat-o can you check if this mey help you? http://stackoverflow.com/questions/24924966/xcode-6-strange-bug-unknown-class-in-interface-builder-file

gorbat-o commented 8 years ago

Ok nice, i understand,

In the storyboard you've got a GreyViewController who never declared in code So it's normal @nschucky :)

edit1: i've tried to remove GreyVC and it's not working too similar to StackO report I'm gonna try some things on it ..

edit2: i've tried to use self.parentViewController in my parent view, and it's not working :'(

And for info, i have coupled Pager with Hakuba right here ^^

edit3: Ok, so, for the moment, i've created a Singleton who's contening a pointer to my parent view, it's working, but it's not recommended i think haha :)

gorbat-o commented 8 years ago

hey, you can use this too for top view controller

static func getTopController() -> UIViewController? {
        if var topController = UIApplication.sharedApplication().keyWindow?.rootViewController {
            while let presentedViewController = topController.presentedViewController {
                topController = presentedViewController
            }
            return topController
            // topController should now be your topmost view controller
        }
        return nil
    }