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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:26:06+00:00 2026-05-20T07:26:06+00:00

The SimpleEKDemo sample has a [self.tableView reloadData] at the end of viewDidLoad in the

  • 0

The SimpleEKDemo sample has a “[self.tableView reloadData]” at the end of viewDidLoad in the RootViewController.m file.

Is this necessary? Any ideas why this line was put in? Wouldn’t the view get drawn subsequently after the viewDidLoad via it’s calls to the delegate to methods like “cellForRowAtIndexPath”?

- (void)viewDidLoad {
    self.title = @"Events List";

    // Initialize an event store object with the init method. Initilize the array for events.
    self.eventStore = [[EKEventStore alloc] init];

    self.eventsList = [[NSMutableArray alloc] initWithArray:0];

    // Get the default calendar from store.
    self.defaultCalendar = [self.eventStore defaultCalendarForNewEvents];

    //  Create an Add button 
    UIBarButtonItem *addButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
                                UIBarButtonSystemItemAdd target:self action:@selector(addEvent:)];
    self.navigationItem.rightBarButtonItem = addButtonItem;
    [addButtonItem release];


    self.navigationController.delegate = self;

    // Fetch today's event on selected calendar and put them into the eventsList array
    [self.eventsList addObjectsFromArray:[self fetchEventsForToday]];

    [self.tableView reloadData];   // ** REALLY NEEDED ** 

}

EDIT – I did note this in the doco (see below) – it’s still not clear to me how the above line of code is required – isn’t it the case that if you went to another view, and then back to this view, THEN if (a) the view is re-initialised than it would have to populate itself again anyway, or (b) if the view wan’t re-initialised the “viewDidLoad” method wouldn’t be called hence you wouldn’t be putting the “reloadData” line of code at the end of the viewDidLoad method in either case no?

UITableView overrides the
layoutSubviews method of UIView so
that it calls reloadData only when you
create a new instance of UITableView
or when you assign a new data source.
Reloading the table view clears
current state, including the current
selection. However, if you explicitly
call reloadData, it clears this state
and any subsequent direct or indirect
call to layoutSubviews does not
trigger a reload.

  • 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-20T07:26:07+00:00Added an answer on May 20, 2026 at 7:26 am

    This is not really needed if you have static data but when you want to update the table content from a data source then you need.

    e.g.

    Suppose you want add a record which you enter in a table and you want to show that data in table when you add that.you have a table on first page then add a record on second view and come back to first view.then you need to show new data but this time your deta source method for table not called thats why you need to reload the data so this line calls table’s data source method.

    I think you can understand the situation.

    Edit:

    When we delete a row then that data delete from database but remains in table if you not call delete with table.
    now you are calling database function and getting record in an array at viewWillAppear function now what you can do
    simply call viewWillappear from commitEditingStyle function and reload the table in viewWillappear.At this situation you need to reload the table

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

Sidebar

Related Questions

The SimpleEKDemo example is delivered with Targeted Device Family = iPhone in the Build
I am trying to use EventKit based around the doco & SimpleEKDemo application, however
In our backend-application we make extensive use of swfupload. It has always worked perfectly
does iPhone simulator calendar store availability correctly for an event? I've got a test
I got the following simple C++ code: #include <stdio.h> int main(void) { ::printf(\nHello,debugger!\n); }

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.