cwRichardKim / RKSwipeBetweenViewControllers

Swipe between ViewControllers like in the Spotify or Twitter app with an interactive Segmented Control in the Navigation Bar
MIT License
1.67k stars 156 forks source link

How to dismiss it #32

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hi,

I have the following structure:

SignUpViewController ---PRESENT MODAL---> MainViewController

i call RKSwipeBetweenViewControllers inside viewDidLoad() from MainViewController.

It works fine. I created a button "disconnect" to come back to SignUpViewController. I must dismiss ViewControllers (myVC1, myVC2, myVC3, myVC4) and also the MainViewController.

i tried this from MainViewController:

-(void)dismissView { UIStoryboard _storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController_vc1 = [storyboard instantiateViewControllerWithIdentifier:@"myVC1"]; UIViewController_vc2 = [storyboard instantiateViewControllerWithIdentifier:@"myVC2"]; UIViewController_vc3 = [storyboard instantiateViewControllerWithIdentifier:@"myVC3"]; UIViewController*vc4 = [storyboard instantiateViewControllerWithIdentifier:@"myVC4"];

//FIRST TRY [vc1.navigationController popViewControllerAnimated:NO]; [vc2.navigationController popViewControllerAnimated:NO]; [vc3.navigationController popViewControllerAnimated:NO]; [vc4.navigationController popViewControllerAnimated:NO];

//SECOND TRY
[vc1.navigationController dismissViewControllerAnimated:NO completion:nil];
[vc2.navigationController dismissViewControllerAnimated:NO completion:nil];
[vc3.navigationController dismissViewControllerAnimated:NO completion:nil];
[vc4.navigationController dismissViewControllerAnimated:NO completion:nil];
[self.navigationController dismissViewControllerAnimated:NO completion:nil];

//THIRD TRY

[vc1.navigationController popToRootViewControllerAnimated:NO]; [vc2.navigationController popToRootViewControllerAnimated:NO]; [vc3.navigationController popToRootViewControllerAnimated:NO]; [vc4.navigationController popToRootViewControllerAnimated:NO]; [self.navigationController popToRootViewControllerAnimated:NO];

}

It's not works. thanks for help ;)