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

  • Home
  • SEARCH
  • 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 6628313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:06:59+00:00 2026-05-25T22:06:59+00:00

My app has two tabs, one of which is a table view, in the

  • 0

My app has two tabs, one of which is a table view, in the other tab I can add the current object to the core data storage, and I wish the table view could be up-to-date anytime I am done adding and switch back to that tab (table view). Currently, the table view only refreshes when my app relaunches which is understandable, because I am getting the data in the viewDidLoad method in that viewController. When I switch back and forth between these two tabs, their views are already loaded, so how can I update the table view in realtime? Any advice would be appreciated.

Update:

A good example is the contact app on iphone, but I don’t know how to do that…


Here is some code in the table view controller.

- (void)viewDidLoad {
    [super viewDidLoad];

    bList = [[NSMutableArray alloc] init];

    self.navigationItem.leftBarButtonItem = self.editButtonItem;

      //some code to get data from core data storage and put them in the bList array.

    [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(receiveAddNotification:) 
                                             name:@"AddNotification"
                                           object:nil];
}

-(void) receiveAddNotification: (NSNotification *)notification{
    if ([[notification name] isEqualToString:@"AddNotification"]){
        NSLog (@"Successfully received the add notification!");
    }
}

Code in the other tab’s view controller.

-(IBAction) addSomething {

    [[NSNotificationCenter defaultCenter] postNotificationName:@"AddNotification" object:self];
        //some code to store an object in core data.
}

The console can output the message “Successfully received the add notification!”, which means the notification works fine, but the table view didn’t get refreshed when I switch back to the table view tab from edit tab. I’m assuming the newly added object in addSomething method should be updated to the receiveAddNotification: method either.

  • 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-25T22:06:59+00:00Added an answer on May 25, 2026 at 10:06 pm

    Hi Michael as I understand your question, You can use notifications concept. Start notification service in the table view controller and when you are done with adding the things you can post the notification so that, that will update the table view automatically.

    Look in to the NSNotificationCenter.

    Let me explain with an example.

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(receiveTestNotification:) 
                                                 name:@"TestNotification"
                                               object:nil];
    

    add the above statement in the table view controller. Then you just define the “receiveTestNotification:” function with [tableview reload];

    And in the editing view controller when user taps the done button you post the notification

    [[NSNotificationCenter defaultCenter] postNotificationName:@"TestNotification" object:self];
    

    So it will call the “receiveTestNotification:” method and run the code what ever you gave in that method.

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

Sidebar

Related Questions

My app has two views, one holds the OpenGL context which is constantly redrawing
I've created a simple iPhone app which has two .xib files. In the app
I've got a settings object for my app that has two collections in it.
I want to design simple app widget which has two textview and two button
I am working on a simple app tab-bar based application that has two views.
I have a project with two localizations add. English and Spanish. My app has
I have an app that has a centre view with two views off to
I have an App which has a Tasks tab and a Projects tab. I
My grails web app has two parts: one for desktop / laptop browsers, one
Have a really weird one here. The app has two targets, just to be

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.