Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

isak

macrumors newbie
Original poster
Dec 22, 2011
1
0
I have created standard Page-Based application in xCode 4.2.1
I need to change ModelController.m

It has method -
Code:
- (DataViewController *)viewControllerAtIndex:(NSUInteger)index storyboard:(UIStoryboard *)storyboard;

for each page this method create new DataViewController


Code:
DataViewController *dataViewController = [storyboard instantiateViewControllerWithIdentifier:@"DataViewController"];

I want to use only one DataViewController instance for all page in this application. To change method
viewControllerAtIndex like this:

Code:
    if (dataViewController == NULL) {
        dataViewController = [storyboard instantiateViewControllerWithIdentifier:@"DataViewController"];
 
    }
        dataViewController.dataObject = [self.pageData objectAtIndex:index];

But this does not work correctly.

Thanks for advance.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.