tags:

views:

141

answers:

0

There are many examples available for apps that switch between just two subviews, but what I am trying to do is set an app that lets me switch between more than 2, such that I'm thinking I need to keep an array of UIViews. The underlying application is to allow the user to page through a list of subviews, forwards or backwards, much like paging through a book. My thought was that the first page would be a UIView, and that every following page would be a subview of that first page (i.e. addSubview:). All subviews would be hidden except the one being viewed by the user. By keeping an array of these UIViews, I thought I could then easily control which view needed to be set visible as the user taps forward or backward.

My problem seems to be that this master array of subviews is not available within all the subviews (it is an instance variable of the page class I created), and i'm having trouble wrapping my head around which instance actually "has control". After my initial initWithFrame processing completes for the first page (where all of the subviews are also added and the master array is built), the next attempt to use the master array results in the program dying, which I guess is because some other instance is now in control.

Should I keep trying to figure this out (and if so, what I am missing here), or is there a better way to structure a multiview (more than 2 subviews..let's say 12 or more) paging app?