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

ViewControllers don't maintain state on modal dismissal #10

Closed aernum closed 9 years ago

aernum commented 9 years ago

When I dismiss a modal within one of my view controllers, the swipe controller somehow resets back to the first view controller in the array. I've tried to set it back to the right view controller in the completion block of the modal dismissal, but that didn't work. Any ideas?

cwRichardKim commented 9 years ago

interesting, do you mind giving me an example? screenshots might help, sorry for the late response

nashsu commented 9 years ago

I have the same problem, I embed the swipe controller in a tab bar controller, and when I change to another tab and then change back, the swipe controller reset back to first view controller. Hope you can help me, thx.

tomoyuki28jp commented 9 years ago

+1 I had the same problem.

cwRichardKim commented 9 years ago

It's funny that this is such an obvious thing but I've never needed it. Hmm, so I will probably work on a full solution some time later, but for now I would recommend storing what page you left off on, and then calling the UIPageViewController delegate function for turning pages

http://stackoverflow.com/questions/7208871/is-it-possible-to-turn-page-programmatically-in-uipageviewcontroller

http://stackoverflow.com/questions/13633059/uipageviewcontroller-how-do-i-correctly-jump-to-a-specific-page-without-messing

Thanks for letting me know, I'll keep this open until I build it out

nashsu commented 9 years ago

I think the reason is that you put setup code in viewDidAppear, I move setup codes into viewDidLoad, and every thing works fine.

cwRichardKim commented 9 years ago

weird, I hardly ever put code in viewDidAppear without good reason. I'll do some investigation, but thanks for helping out

aernum commented 9 years ago

Hi @cwRichardKim this was closed but was it fixed?

cwRichardKim commented 9 years ago

Apologies, forgot to push but yea this should be fixed at master