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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:10:01+00:00 2026-05-24T21:10:01+00:00

I need help with updating a label through in applicationDidBecomeActive . The way my

  • 0

I need help with updating a label through in applicationDidBecomeActive. The way my project is structured, I have a RootViewController. When the user touches a button, a new view controller is opened through presentModalView. I want to update the label on this view controller each time the application becomes active. This is my code in my app delegate:

WordList1 *viewController1 = [[WordList1 alloc] initWithNibName:@"WordList1" bundle:nil];
[viewController1 changelabel:counter];
[viewController1 release];

And it calls this function in my WordList1 viewcontroller to update the label each time:

  - (void) changelabel:(int)counter {
    NSString *string = [NSString stringWithFormat:@"%d", counter];  
    label.text = string;
}

When I run it through debugger, the value of “counter” and “string” are updating, but the label is not changing values. Please help

  • 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-24T21:10:02+00:00Added an answer on May 24, 2026 at 9:10 pm

    Where have you created your UILabel? If it is created through your xib file, make sure you have connected the File Owner’s IBOutlet to the correct label. If not connected, it does not know what label to update.

    EDIT:
    I believe that updating your label from the AppDelegate is bad code design. The label should really be updated from a view controller. My guess is that you are putting the code in the AppDelegate because that’s where the code is that is called when the app enters the foreground. To update the label from a view controller when the app enters the foreground, you can set up a notification in the view controller. Code example:

    - (id)init
    {
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(changeLabel:)
                                                     name:UIApplicationWillEnterForegroundNotification
                                                   object:nil];
        return self;
    }
    

    This registers the view controller as an observer to be notified each time the app will enter the foreground. This way, you can contain this code in your view controller, and have it be updated accordingly.

    Also, make sure you unregister the observer when the view controller is deallocated, by adding the following to your dealloc method:

    [[NSNotificationCenter defaultCenter] removeObserver:self];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need help with this route map routes.MapRoute(Blog_Archive, Blog/Archive/{year}/{month}/{day}, new { controller = Blog,
I need help to replace all \n (new line) caracters for in a String,
i need help with disk_total_space function.. i have this on my code <?php $sql=select
I need a little help with updating my UI from Runnable/Handler every second. I'm
I have a multilanguage website and need automate the process of updating textlayers in
When insert/updating an entity I need to log all the properties that have changed.
Need help in updating records using LinQ. I tried updating the record, but it
need help on copying while updating multiple rows of data from one table to
Hi I need help implementing a logic using Gridview control in c#. I have

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.