mluton / EmbeddedSwapping

Demonstration of how to make a custom container view controller manage multiple child view controllers using storyboards.
MIT License
208 stars 30 forks source link

Issue when adding more than 2 child viewcontrollers #7

Closed farazhaider88 closed 10 years ago

farazhaider88 commented 10 years ago

i have customize your code to make it work for more than 2 viewcontrollers, it starts crashing when ever i start quickly moving on each controllers, can you please check what i m doing wrong here.

import "ContainerViewController.h"

import "VenueDetailViewController.h"

import "MenuViewController.h"

import "LocationViewController.h"

define SegueIdentifierFirst @"embedMain"

define SegueIdentifierSecond @"embedMenu"

define SegueIdentifierThird @"embedMap"

@interface ContainerViewController ()

@property (strong, nonatomic) NSString currentSegueIdentifier; @property (strong, nonatomic) VenueDetailViewController venueDetailController; @property (strong, nonatomic) MenuViewController venueMenuController; @property (strong, nonatomic) LocationViewController venueMapController; @property (assign, nonatomic) BOOL transitionInProgress;

@end

@implementation ContainerViewController

}

farazhaider88 commented 10 years ago

swapViewControllers was called from my main class and i m passing tag of buttons from there.

mluton commented 10 years ago

Do you have a fork of this repository or something I could look at? If not, that's okay. I can use your code and add a third view controller. Are you triggering the swap with three different buttons or a single segmented button? Please forgive me if I'm not responsive over the weekend but I do want to take a look at this as soon as I can after the weekend.

farazhaider88 commented 10 years ago

i m using three different buttons. giving them different tags. using a class variable to hold the value so if you are on the same control as the tag than this function wont call but if not than this function called, i put value of animation to 0.0 but still it does not solve the problems. thanks for your cooperation.

farazhaider88 commented 10 years ago

this is how iam calling it:

segueIndex is local variable.

mluton commented 10 years ago

Okay, I started with the original example and added a third view controller and three buttons instead of just the one. The solution here is the result of a quick afternoon hack session and isn't all that elegant but it should work without timing issues. I created a threebuttons branch with my solution. Hopefully, this helps. Let me know how it works out for you.

FabioDev84 commented 9 years ago

Hello ... forgive me if I open again this post but I have a problem ... I also need to work with three viewcontroller instead of two, but the difference for me is that I do not need three buttons to operate the following but using a single button ... Could you help me understand how I can add another ViewController not change the function of your original button?