Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This will probably provide the result that you seek:</p> <pre><code>-(void)textLabelChanger:(id)sender { NSString *myTextLabelString = [NSString stringWithFormat:@"%d", gameCountDown]; textLabel.text=myTextLabelString; [self performSelector:@selector(updateTextLabelWithString:) withObject:@"sleep 5 worked" afterDelay:5.0]; [self performSelector:@selector(updateTextLabelWithString:) withObject:@"sleep 5 worked second time round" afterDelay:10.0]; } -(void)updateTextLabelWithString:(NSString*)theString { textLabel.text=theString; } </code></pre> <p>There are plenty of ways to do this. Instead of having a single <code>updateTextLabelWithString</code> that you call twice with different delays, you could have a <code>doFirstTextUpdate</code> that writes the "sleep 5 worked" and then calls another selector like <code>doSecondTextUpdate</code> using the same <code>[self performSelector:]</code> technique after another 5 second delay.</p> <p>It's exceedingly rare that you'll need to use the <code>sleep()</code> method with Objective-C.</p> <pre><code>-(void)textLabelChanger:(id)sender { NSString *myTextLabelString = [NSString stringWithFormat:@"%d", gameCountDown]; textLabel.text=myTextLabelString; [self performSelector:@selector(firstUpdate) withObject:nil afterDelay:5.0]; } -(void)firstUpdate { textLabel.text = @"sleep 5 worked"; [self performSelector:@selector(secondUpdate) withObject:nil afterDelay:5.0]; } -(void)secondUpdate { textLabel.text = @"sleep 5 worked second time round"; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload