Page-Based application modification

Discussion in 'iOS Programming' started by isak, Dec 22, 2011.

  1. isak macrumors newbie

    Joined:
    Dec 22, 2011
    #1
    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.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Doesn't work how? What are you expecting to happen? What is actually happening. Please be specific.
     

Share This Page