views:

22

answers:

1

I have a scrollview that has a page control. The scrollview contains 3 views. Each view contains a view controller. In one of my view controllers I press a button and I want the scrollview to scroll to a specific location. But Im not sure how to accomplish that since the button is not in the UIScrollview but in one of the view controllers. Could anyone point me in the right direction with this? I have spent a lot of time trying to follow the view hierarchy to see if I can send a message to the scrollview for it to scroll. Any help is appreciated.

A: 

You can:

  1. Add a delegate in your 3 inner View Controllers that points to the View Controller that holds your Scroll View.
  2. Create a method in the View Controller that holds the Scroll View that will call [scrollView zoomToRect:] when called.
  3. Access it from your 3 inner View Controllers using the delegate.

If you need more information about delegation. check http://stackoverflow.com/questions/2978977/what-is-delegate-in-iphone.

Altealice