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 6656311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:37:40+00:00 2026-05-26T01:37:40+00:00

I have 4 UITableView’s on my iPAD application. I load the data on them

  • 0

I have 4 UITableView’s on my iPAD application.
I load the data on them using a function loadData ,which is there in all the 4 TableViewController.m files, which makes calls to the database.

So, I would be doing something like this

[aView loadData];
[bView loadData];
[cView loadData];
[dView loadData];

Where aView, bView, cView and dView are the view controllers of the UITableView’s.

However, the database calls happen synchronously and hence only after the data is retrieved from the [aView loadData] function, does the [bView loadData] function get called and so on.

This affects my performance.

I would like to know if there is a way I can asynchronously make calls to the database/ asynchronously make calls to functions which calls database.

It would be great if someone could help me out with this.

  • 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-05-26T01:37:40+00:00Added an answer on May 26, 2026 at 1:37 am

    You can use GCD for this:

    -(void)loadList
    {
       // You ma do some UI stuff
       [self.activityIndicator startAnimating]; // for example if you have an UIActivityIndicator to show while loading
    
       // Then dispatch the fetching of the data from database on a separate/paralle queue asynchronously (non-blocking)
       dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    
          // this is executed on the concurrent (parallel) queue, asynchronously
          ... do your database requests, fill the model with the data
    
          // then update your UI content.
          // *Important*: Updating the UI must *always* be done on the main thread/queue!
          dispatch_sync(dispatch_get_main_queue(), ^{
              [self.activityIndicator stopAnimating]; // for example
              [self.tableView reloadData];
          });
       });
    }
    

    Then when you will call the loadList method, the activityIndicator will start animate, and the fetching process of your data will be started on a separate queue asynchronously, but the loadList method will return immediately (not waiting for the block in dispatch_async to finish executing, that’s what dispatch_async is for).

    So all your call to your 4 loadList implementations in each of your viewcontrollers will execute immediately, (triggering the fetching of your data asynchronously but not waiting for the data to be retrieved). Once the database requests — that was executing in a parallel queue — have finished in one of your loadList method, the dispatch_sync(...) line at the end of the block is executed, asking the main queue (main thread) to execute some code to refresh the UI and display the newly-loaded data.

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

Sidebar

Related Questions

Currently I have UITableView and simple UIView in my iPad application. Each of them
I have a UITableView which is populated with some parsed JSON twitter data. The
I have UITableView and I want to load more data when user tries to
I have UITableView with custom cells, which contain uilabels. I am using it to
I have a UITableView which is populated by an array, I have a button
i have an UITableView in my app and i have to load some images
guys. I have UITableView with different cells and I have code, which counts height.
I have a UITableView and the data is pulled from a database stored externally.
I have a UITableView which I fill with CoreData fetched results. I want to
Hi i have UITableView with x rows and my cell data loaded with plist

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.