parser and pushViewController issue

Discussion in 'iOS Programming' started by MACloop, Feb 24, 2010.

  1. MACloop macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #1
    Hello,
    I have a tableView with clickable cells, letting the user navigate to another tableView. I use the code:
    Code:
    [self.navigationController pushViewController:theViewToBeShowed animated:YES];
    to get the view to be displayed.
    The view will be "created" everytime the user clicks on one of the cells. My problem is that I, in the viewDidLoad section, have an NSURLConnection and a XMLParser to get the info to be showed in the view and I only want to make this once or at least not everytime the view is displayed. Is it possible to only make it once?

    Thanks in advance
    MACloop
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Yes. See the SeismicXML sample app for how this can be done.
     
  3. MACloop thread starter macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #3
    Thanks for the advice! I will do that!
    MACloop
     
  4. MACloop thread starter macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #4
    So I took a look at the example and one question has come up:

    in the applicationDidLaunching method the following code is used:
    Code:
     static NSString *feedURLString = @"http://earthquake.usgs.gov/eqcenter/catalogs/7day-M2.5.xml";
        NSURLRequest *earthquakeURLRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:feedURLString]];
        self.earthquakeFeedConnection = [[[NSURLConnection alloc] initWithRequest:earthquakeURLRequest delegate:self] autorelease];
    If I would like to read data from say 5 or 10 different urls to fill into my different views - should I create seperate URLConnections for each and every of them? How should I do with the parsing? Do I optimally create parsers for all of my xml-files?

    Thanks in advance,
    MACloop
     
  5. MACloop thread starter macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #5
    Any ideas?
    Should I use the same structure as in the sample app and define different parsers for the different xml-files to be read? Should I serve the different viewcontrollers with data from the AppDelegate? How do I do this in an optimal way?
    Thanks in advance!
    MACloop
     

Share This Page