kawoou / KWDrawerController

Drawer view controller that easy to use!
MIT License
157 stars 32 forks source link

Use in Objective-C project #9

Closed andyden9 closed 6 years ago

andyden9 commented 6 years ago

Hi Kawoou,

I'm using your framework through CocoaPods, I use it exactly as your instruction, but storyboard failed to init DrawerController and returns a plain UIViewController as the initial ViewController. Do you happen to know what's the issue here? Thank you so much in advance!

2018-01-16 6 26 29 2018-01-16 6 26 35 2018-01-16 6 26 43 2018-01-16 6 26 48
kawoou commented 6 years ago

Hi andyden9. You say mean that even if you specify a "Custom Class" in the identity inspector, it is initialized as if the default UIViewController.

andyden9 commented 6 years ago

Yes exactly, do you happen to know what caused this? I've stuck on this for more than 5 hrs😭

2018-01-17 10 52 24 2018-01-17 11 14 35
kawoou commented 6 years ago

I mean the ViewController with "left" or "main". How did you find out that the DrawerController was initialized with a pure UIViewController?

andyden9 commented 6 years ago

Oh sorry, lol, because I set the DrawerController as the initial View Controller, and after storyboard init, I only got a blank UIViewController as I showed in the debug view hierarchy. Are you busy today? Could you add my wechat(anddddddy) or skype(appleandy94) to instruct me a bit if you're available?

2018-01-17 10 52 24 2018-01-17 11 14 35

I got them all set:

2018-01-16 6 26 48 2018-01-16 6 26 43 2018-01-16 6 26 35

The only difference between your demo and my project I can find is, the demo is a pure swift project, and mine is a pure objective-c project....

andyden9 commented 6 years ago

Sorry my bad, it seems showing the '😭' label, so DrawerController is inited, I guess the problem is the DrawerController not showing the 'main' controller.

2018-01-17 11 57 43

If it works, simulator should show this:

2018-01-17 12 02 00
andyden9 commented 6 years ago
2018-01-17 12 33 58

I found something else, though it's correctly set in the story board as shown(in previous messages), the viewDidLoad method in DrawerController never gets called....

kawoou commented 6 years ago

You use the swift library in the objective-c project. If so, did you specify a bridge header?

This symptom seems to be similar to what happens when a Custom Class is incorrectly specified.

andyden9 commented 6 years ago

Yes I am using the KWDrawerController as the only swift library in my objective-c project 😱 and I didnt' specify a bridge header since I thought CocoaPods will automatically generate it for me..... I guess that's the issue, let me try to specify a header manually. Thank you Kawoou! 🙏

kawoou commented 6 years ago

Fortunately! Happy Development😆

andyden9 commented 6 years ago

Hi Kawoou!

Storyboard is still no luck for me so I switched to code, and I've found an issue, that the setViewController:side: method in DrawerController maybe duplicated with some system method so OC can't find this method.

After rename this to setVController:side: I can use it and everything just work out fine in OC.

May I submit a pull request to fix this? Just name changing.

Cheers, Andy

andyden9 commented 6 years ago
2018-01-17 3 35 56
kawoou commented 6 years ago

It's really weird in objc!

PR is always welcome, even with small modifications 👍 Thank you for using this project.

andyden9 commented 6 years ago

Thank you for sharing this great library! I've submitted the PR, please review.