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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:42:41+00:00 2026-05-28T18:42:41+00:00

Every time this tab get loaded instead of updating the dynamic label, it writes

  • 0

Every time this tab get loaded instead of updating the dynamic label, it writes a brand new label over it. What do I need to put in this code so that it updates it or clears the dynamic labels and then put in the new label. I feel like its probably just a simple one line fix. Here is a simplified version of the code:

- (void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:YES];
        goalArray = [[NSMutableArray alloc] init];
        NSURL *url = [NSURL URLWithString:@"http://localhost/goal.php"];
        ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
        [request setPostValue:test forKey:@"name"];
        [request setDelegate:self];
        [request startAsynchronous];         
    }
    - (void)requestFinished:(ASIFormDataRequest *)request
    {
       ...
            for (id myArrayElement in goalArray) 
            {
                NSLog(@"y value:%i", yValue);
                UILabel *label =  [[UILabel alloc] initWithFrame: CGRectMake(0, yValue, 80, 44)];
                label.font = [UIFont systemFontOfSize:12];
                label.textColor = [UIColor blackColor];
                label.backgroundColor = [UIColor clearColor];
                label.text = myArrayElement;
                [self.view addSubview:label];
                yValue += 44;
            } 
        }
  • 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-28T18:42:42+00:00Added an answer on May 28, 2026 at 6:42 pm

    In requestFinished: before the for loop, add this:

    for ( UIView *die in [self subviews]) {   // clear out previous label
        if ( die.tag == 123 ) {
           [die removeFromSuperview];
        }
    }
    

    and then inside your for loop, add this:

    label.tag = 123;  //doesn't have to be 123, as long as it's an int that matches the one above.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to make this mistake every time I set up a new development
I tried decoding this base64 string so many times but every time i get
I'm sure this is a newbie question, but every time I've compiled/dl'ed a new
Every time I open a new terminal in Mac OSX Lion, rails isn't loaded.
Every time I call this method my NSMutableData is leaking and I cannot figure
Every time in PHP when I make a variable such as this one: $date
I have this warning every time I run my CGI-script (output is rendered by
I find this syntax astoundingly annoying. Every time I rename my class, I have
I think beestings change the html every time. this means html is not able
This seems like it should be something very easy to do, but every time

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.