Closed ghost closed 9 years ago
Hi,
I have the following structure:
SignUpViewController ---PRESENT MODAL---> MainViewController
i call RKSwipeBetweenViewControllers inside viewDidLoad() from MainViewController.
(void)viewDidLoad { [super viewDidLoad];
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; navigationController = [[RKSwipeBetweenViewControllers alloc]initWithRootViewController:pageController]; self.scrollViewGeneral = [navigationController getUIScrollView]; [myManager setMyGeneralVC:self];
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"];
[navigationController.viewControllerArray addObjectsFromArray:@[vc1, vc2, vc3,vc4]];
self.window.rootViewController = navigationController; [self.window makeKeyAndVisible]; }
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 ;)
Hi,
I have the following structure:
SignUpViewController ---PRESENT MODAL---> MainViewController
i call RKSwipeBetweenViewControllers inside viewDidLoad() from MainViewController.
(void)viewDidLoad { [super viewDidLoad];
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; navigationController = [[RKSwipeBetweenViewControllers alloc]initWithRootViewController:pageController]; self.scrollViewGeneral = [navigationController getUIScrollView]; [myManager setMyGeneralVC:self];
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"];
[navigationController.viewControllerArray addObjectsFromArray:@[vc1, vc2, vc3,vc4]];
self.window.rootViewController = navigationController; [self.window makeKeyAndVisible]; }
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];
[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 ;)