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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:31:31+00:00 2026-06-04T15:31:31+00:00

My app has an UITabViewController with 3 tabs. The first two tabs will read

  • 0

My app has an UITabViewController with 3 tabs. The first two tabs will read some data from disk and display it (done in viewDidLoad of the first two tabs).

The third tab has some kind of config information. If the user changes the config information in the third tab, i want the first two tabs to be refreshed, i.e., viewDidLoad should be re-called.

I cannot use viewWillAppear in the first two tabs, as the read from disk part is kind of intensive and I wouldn’t want to do it everytime the tab is clicked. Also, I need to do some auxiliary tasks (in addition to updating the first two tabs) when the third tab data is edited, so I want to reload the tabs via viewDidLoad, while doing those auxiliary tasks.

  • 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-04T15:31:32+00:00Added an answer on June 4, 2026 at 3:31 pm

    Use NSNotifications to do this.

    Since the third tab is your config settings you will probability want to be storing these in NSUserDefaults so use the NSUserDefaultsDidChangeNotification to watch for this in your viewDidLoad method and move your reloadData code into its own method.

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
        [notificationCenter addObserver:self
                               selector:@selector(userDefaultsChanged:)  
                                   name:NSUserDefaultsDidChangeNotification
                                 object:nil];
    
        [self reloadData];
    }
    

    Now this will trigger a call to the method userDefaultsChanged: whenever your defaults are changed, add the method as follows.

    - (void)userDefaultsChanged:(NSNotification *)notification
    {
        [self reloadData];
    }
    
    - (void)viewDidUnload
    {
        [super viewDidUnLoad];
    
        [[NSNotificationCenter defaultCenter] removeObserver:self];
    }
    

    Edit: Alternative method to watch for specific default values

    [[NSUserDefaults standardUserDefaults] addObserver:self
                                            forKeyPath:@"SomeDefaultKey"
                                               options:NSKeyValueObservingOptionNew
                                               context:NULL];
    
    - (void)observeValueForKeyPath:(NSString *) keyPath ofObject:(id) object change:(NSDictionary *) change context:(void *) context
    {
        if([keyPath isEqual:@"SomeDefaultKey"])
        {
           // Do Something
        }
        if([keyPath isEqual:@"SomeOtherKey"])
        {
           // Do Something else
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an app that has a UITableView. The data will be comming from
I recently started to develop an iPhone App. Coming from C#, Objective-C has some
I have an app with some tabs at the bottom (UITabViewController), and most of
My app has 6 menu items, so the OS shows the first 4, then
My app has some table cells that vary in height. The cells can also
My app has to load an image from a http server and displaying it
My app has a registered shutdown function and it seems there's some issues with
Our app has a UITableViewController with some custom section headers. These section headers are
I have a UITableViewController which has two sections. The first section shows a single
In my app, I have a UITableViewController which loads calculated data from my Core

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.