So I have a scroll view with 3 other views as subviews. Using the scroll view to page between the 3 subviews which have their controllers stored in an array.
- (void)viewDidLoad
{
[self loadData];
self.uiScrollView = [[UIScrollView alloc] initWithFrame:self.view.frame];
[self.uiScrollView setPagingEnabled:YES];
[self.uiScrollView setContentSize:CGSizeMake(self.view.frame.size.width*3, self.view.frame.size.height)];
self.uiScrollView.delegate = self;
[self.view addSubview:self.uiScrollView];
self.uiPhotoCollectionViewControllers = [[NSMutableArray alloc] init];
int numberOfOtherViews = 3;
int subViewOffset = 0;
for (int i = 0; i < numberOfCollectionViews; i++)
{
UIViewController* uiViewController = [[UIPhotoCollectionViewController alloc] initWithData:dataArray];
// add offset to the view of the controller
[self.uiScrollView addSubview:uiViewController.view];
[self.uiViewControllers addObject:uiViewController];
uiViewController.view.frame = CGRectOffset(uiViewController.view.frame,subViewOffset,0.0f);
subViewOffset = subViewOffset + uiViewController.view.frame.size.width;
}
If I later wanted to switch the view in the middle of the scroll view with the first one, how would I go about this without removing all teh scroll views subviews and replacing them.