indievox-inc / TabBarSplitViewController

Adaptive UISplitViewController with UITabBarController as primary view controller.
MIT License
18 stars 3 forks source link

Use it with Storyboard #4

Open nairpic opened 8 years ago

nairpic commented 8 years ago

Hi...it is possible to use it with storyboard?

fukuball commented 8 years ago

Hi, @nairpic We'll think about that~ But you can build it and play the code now

nairpic commented 8 years ago

Hi, would be really nice to be able to use it from storyboard(it's easier to maintain a perspective over the flow). I played with it. Unfortunately I didn't manage to push a new VC from a presentedDetailedView(rotating to landscape goes into the break condition).

I started to make my own for my case and hopefully will finish :) . At this moment I'm losing the navigationController of the detailPage when I rotate to landscape, everything else seems to work ok.

Thanks for your help

fukuball commented 8 years ago

Thanks your reply, we'll fix the issue~

denkeni commented 8 years ago

@nairpic What device are you rotating, iPhone 6 Plus or iPad? It'll be clear whether it's related to size class changes, and, is your secondary view controller using UINavigationController?

nairpic commented 8 years ago

Hi @denkeni I have the problem on iPhone6+, the rest of the devices are working ok. Yes, it is a UINavigationController

denkeni commented 8 years ago

@nairpic I'm not familiar with storyboard, but I just played with it and succeeded implementing TabBarSplitViewController with storyboard.

I would guess you are still using UISplitViewController and there's issue when secondary view controller is UINavigationController, as I mentioned in Introduction of README.md. You got to implemented related UISplitViewControllerDelegate methods, and that is exactly what TabBarSplitViewController has done for you.

To use TabBarSplitViewController in storyboard, drag a "Split View Controller" to storyboard and change its class to TabBarSplitViewController. Since storyboard will init it with initWithCoder:, which I haven't implemented yet, some modifications will be required...

Stay tuned for further update, or pull request is also welcome :)

nairpic commented 8 years ago

@denkeni thanks for your quick responses and help .... I will let you know if I succeed ... I've already put this on my watch list :)

denkeni commented 8 years ago

@nairpic I can't figure out a way to make the code compact and support storyboard as well, due to strict nature of Swift syntax. I'll suggest you just take TabBarSplitViewController.swift and modify init?(coder aDecoder: NSCoder) for using in storyboard, like this for your case:

required public init?(coder aDecoder: NSCoder) {
    self.SecondaryViewControllerType = UINavigationController.self
    self.SecondaryInsideViewControllerTypes = (DetailViewController.self, EmptyDetailViewController.self)
    super.init(coder: aDecoder)

    preferredDisplayMode = .AllVisible
    delegate = self
}

and manage your storyboard. I have just put an example project TabBarSplitViewControllerDemo-Storyboard, take a look.

Furthermore, this doesn't actually implement NSCoding, but it seems worked for storyboard.

nairpic commented 8 years ago

Hi @denkeni ... I will test the flow in the weekend to see how it behaves..At this moment I made my own, still have some small issues but for sure will test yours and come back with a feedback...thanks