Question

I have created a project which uses page control. I used a tutorial to be able to do this. (link to the tutorial: http://www.wannabegeek.com/?p=168)

However each page that I have created in my page control has a button which will take me to another view controller.

I have created a segue which will take me back to the original View of where the button was pressed. But this then doesn't load my page view scrolling again.

The only way I managed to get around this was to segue it back to the parent View controller. By doing this is loads my scroll view again but doesn't take me to the same view controller where the button was pressed.

Was it helpful?

Solution

Though this is not too much information about what you did, I guess your approach is correct: Return to the scroll view you must :-) And when I look at the tutorial you linked, I see that in method viewWillAppear: it resets the current page:

self.pageControl.currentPage = 0;
_page = 0;

Now I would guess that if this is not resetting to 0, but rather to the last visible page before you navigated away, it should work. So you have to store the page you navigate away from, just before crossing the segue, and return to this page instead of returning to index 0.

Hope this helps, nobi

OTHER TIPS

I just wanted to let everybody know how i done this.

As mentioned in the comment above I looked at the following lines of code:

self.pageControl.currentPage = 0;
_page = 0;

This indeed does reset the page. As I am new to xCode the only solution I found was that I created a new view controller for each child view, I then segued back to the view controller that had the page number stored.

This solution seemed to work for me I understand that there are probably neater and more efficient ways to this, I just didn't know how.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top