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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:30:46+00:00 2026-05-22T23:30:46+00:00

I have a UIViewController subclass which is having its view created programmatically within the

  • 0

I have a UIViewController subclass which is having its view created programmatically within the loadView method. The primary purpose of the view is to display information that is fetched from a store via core data. How the view is created will be different depending on how many entities are received from the fetch, so I need this information ahead of time. I believe all of the tutorials and sample code that I have seen so far shows fetch requests being executed in viewDidLoad (or later), so I just wanted to ask if there are any reasons to avoid doing this in loadView. Does it make any difference if I use fetches in loadView like so or in viewDidLoad? Thanks.

- (void)loadView {
    [super loadView];

    NSError *error = nil;
    if (![self.fetchedResultsController performFetch:&error]) {
        ///
    }

    //...go on to load the view
}
  • 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-22T23:30:47+00:00Added an answer on May 22, 2026 at 11:30 pm

    If you are loading data once per setup-tear down cycle of the View Controller then putting it in loadView should be fine.

    However if you have any buttons or UI inputs that may cause it to be reloaded, you may want to create your own reloadData method in your View Controller.

    Take a look at some examples of UITableView with Core Data to get a feel for a common approach to loading core data objects in Cocoa. The UITableView uses the fly wheel pattern, meaning it reuses the table cell (row) objects and just inserts new data as it goes.

    If you have lots of entities returned by CD, consider using a UITableView and you can style it up to look quite different from the norm if you need to.

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

Sidebar

Related Questions

I have a UIViewController subclass which has the view property set to a UIScrollView
I have a subclass of UIViewController which handles a UIView. The viewcontroller is presented
I have a custom UIViewController subclass, which gets pushed on a UINavigationController stack. I
in app i have custom tableview(UITableView *tableView) which subclass of uiviewcontroller & in tableview
I have a UIViewController that manages the display of some data. When the user
I have a UIViewController subclass that accesses self.navigationController in viewDidLoad:. Depending on where it
I have a UIViewController subclass to control a UIView that I want to add
I have a very simple subclass of UIViewController : @interface RoastChickenViewController : UIViewController {
I have an UIViewController subclass that allows the user to add a new model
my application has a UIViewController subclass which is being managed by a UINavigationController. In

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.