I have quite a complex setup, and am looking for advice in how to structure my code. What I'm trying to do is something similar to twitter when you press one of a users images and can swipe through them. This is what I have at the moment:
- A
UIViewControllersubclass that gathers data from a server, and passes it to aUITableViewControllersubclass through a variable calledtheData - This
UITableViewControllersubclass also gathers more data as the users scrolls to the bottom of the table view and appends it totheData(i.e. uses pagination). ThisUITableViewControllersubclass is reused throughout the app so that data from a different source can be passed to it. - When a user clicks on a
UITableViewCell, aUIWindowis created which has aUIPageViewControllerinside it. The window uses theUITableViewControlleras a delegate to accesstheData, and passes thetheDatafrom the delegate to theUIPageViewControllerin a variable calledpageData - Each page of the
UIPageViewControlleris aUIViewControllerthat loads images from thepageData
The next stage is to do pagination as the user swipes to the end of the pageData in the UIPageViewController. However I don't think my code is structured well enough to reuse the pagination code from the UITableViewController. Please could someone give me advice on how to improve this code structure?
Thank you
EDIT
The UIViewController in the first bullet point does more than just downloading data (it has other views within it).
I use a UIWindow to encapsulate the UIPageViewController because I want it to expand from the frame of the UITableViewCell and "take over" the full screen - covering the status bar.