Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8327357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:04:59+00:00 2026-06-09T01:04:59+00:00

I have an UITableView that is populated with parsed XML elements from the Internet.

  • 0

I have an UITableView that is populated with parsed XML elements from the Internet.

All is working fine, but I’d like to separate the code to parse the XLM elements from the UIViewController that is responsible to populate this UITableView.

I’ve tried sublassing the UIViewController, but it seems to cause many coupling problems.

What’s the best way to separate this XML asynchronous parser code, and then feed its results to the UIViewController that contains the UITableView?

I don’t understand much of delegates, but is this the way to go?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:05:00+00:00Added an answer on June 9, 2026 at 1:05 am

    Write an object that handles the parsing, create an instance of it in your view controller, and then call it to load up the data:

    @protocol SomeXMLParserHandler <NSObject>
    
    - (void) handleData:(NSArray *)data;
    
    @end
    
    @interface SomeXMLParser : NSObject<NSXMLParserDelegate>
    
    @property (strong, nonatomic) id<SomeXMLParserHandler> handler;
    
    - (void) parseSomeXMLFromURL:(NSString *)url
                andPassToHandler:(id<SomeXMLParserHandler>)handler;
    
    @end
    

    In this example, SomeXMLParser would do all the heavy lifting and pass an array back to SomeXMLParserHandler when it’s done. So in your view controller you could do something similar to this:

    - (void) viewDidLoad
    {
        [super viewDidLoad];
    
        SomeXMLParser *parser = [[SomeXMLParser alloc] init];
    
        [parser parseSomeXMLFromURL:@"http://someurl"
                   andPassToHandler:self];
    }
    
    - (void) handleData:(NSArray *)data
    {
        self.tableViewData = data;
    }
    

    This isn’t working code but it should get you going in the right direction, especially if you already have the parsing code working. Also, if your into Blocks… you could swap out the protocol with a Block reference to do the work once parsing has completed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableView that lists comments from various users. I save all of
I have a UITableView that gets populated from CoreData via a controller that implements
I have a uitableview that is populated from a sqlite query. I want to
I have a UITableView that's populated using core data & sqlite. I'd like to
I have a UITableView that is being populated from an NSMutable array that has
I have a UITableView populated with a mutablearray that is read from NSUserDefaults. I
I have a UITableView that is populated with custom cells (inherited from UITableViewCell ),
I have a UITableView that is being populated by core data. Now, when I
I have a UITableView that displays various nsstrings from a custom object called a
I have a UITableView that is populated with cells of a variable height. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.