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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:44:18+00:00 2026-06-09T04:44:18+00:00

I am trying to do something very simple: update a few labels on my

  • 0

I am trying to do something very simple: update a few labels on my (one and only) view controller when the application becomes active after coming from the background (say with the current time for the simplicity of it (even though in my case, I am updating telephony parameters, such as call states, etc., but that should not matter)).

Honestly, I was sure that once I call viewDidLoad, the code in this method runs again and so all my labels will be up to date. But that doesnt happen, unless I kill the app and relaunch it, so what I did in the app delegate under applicationDidBecomeActive, I called my view controller method:

ViewController *vc = [[ViewController alloc] init];
[vc refreshCalls];

Which does execute this code, but nothing happens to the labels. When doing this, I am also showing an UIAlertView that DOES have the updated info on it, but not the labels.

How can I fix this? Any ideas would be very appreciated.

Here is my app delegate applicationDidBecomeActive method:

- (void)applicationDidBecomeActive:(UIApplication *)application
{

ViewController *vc = [[ViewController alloc] init];
[vc refreshCalls];
}

And the refreshCalls method in the view controller:

 -(void) refreshCalls {

NSDate *today = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// display in 12HR/24HR (i.e. 11:25PM or 23:25) format according to User Settings
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSString *currentTime = [dateFormatter stringFromDate:today];
NSLog(@"User's current time in their preference format:%@",currentTime);

  UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"TIME" message:currentTime delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil , nil];

 [alert1 show]; --> does show an update time        

myLabel.text = currentTime;
[self.view addSubview:myLabel]; --> nothing happens, stays the last time

 }
  • 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-09T04:44:20+00:00Added an answer on June 9, 2026 at 4:44 am

    First of all, you shouldn’t call ViewDidLoad. It gets called for you, just like applicationDidBecomeActive.

    Now, to the answer:

    What is happening is that you are calling your refreshCalls method on a new ViewController instead of your existing one, which you probably created somewhere in your app delegate. When you first created your ViewController, you probably added its view to UIWindow.

    Then, when you create a new ViewController in applicationDidBecomeActive and call refreshCalls on it, it gets updated just like it should, but its view is not shown on the screen, because you didn’t add it to UIWindow.

    Try to locate in your appDelegate where do you first create your ViewController and assign it to a property. Then, instead of creating a new ViewController in applicationDidBecomeActive, get your existing one and call your refreshCalls method on it.

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

Sidebar

Related Questions

I'm trying something very simple. Upon page load the data in content div is
I'm trying to do something very simple, yet I can't seem to find the
I am trying to accomplish something very simple, and I'm hoping someone can point
I am new to Raphael and am trying to do something very simple, but
I am new to Raphael and am trying to do something very simple, but
Hey all, I am trying to accomplish something very simple yet getting an error
I am using flask , and trying to do something very simple using the
I'm trying to do something which is probably very simple, I have a directory
I'm having a very hard time trying to do something very simple. Here's the
I am trying to do something very simple: create a new branch. But I

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.