How to implement NSTimer in phone sdks?
<p>I want to implement a timer functionality in my app. I know how to implement timer in iOS, but this is something difficult in my words, that I have a string that contains some values from the UITableview cell (like "red, blue, green, violet"). These are comma separated and I want to set a condition with the help of timer. My need is I want to share these values to GoogleDoc, single uploading is successful, but I can't do the multiple uploading, so my thought is to use the timer for uploading these values one by one in a fixed timing:</p>

<pre><code>[NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(myMethod) userInfo:nil repeats:YES];
</code></pre>

<p>I want to set condition for, if red is default, so we don't want to set timer for that, after 2 seconds blue have to be uploaded, then after 2 seconds green, like all. So how to set a condition for this in "myMethod"?</p>

<p>This is my uploading code contains string "str" (<code>str</code> contains the move values):</p>

<pre><code>- (IBAction)doUpload:(id)sender
{

   NSMutableString *str = [[NSMutableString alloc] initWithString:@"NOTES:"]; 
    for (int i = 0; i&lt;[appDelegate.notesArray count]; i++) { 
        UploadView *uploadview = (UploadView *)self.view; 
        if (uploadview != nil) 
        { 
            NSString * aString = [[NSString alloc] initWithString:[appDelegate.notesArray objectAtIndex:i]] ;
            [m_owner uploadString:aString]; 
        } 
        if (selected[i]) 
            [str appendFormat:@"%@ ,",[appDelegate.notesArray objectAtIndex:i]];
}
</code></pre>

<p>Please help me to do this. Thanks in advance.
EDIT:</p>

<pre><code>- (IBAction)doUpload:(id)sender
{

   NSMutableString *str = [[NSMutableString alloc] initWithString:@"NOTES:"]; 
    for (int i = 0; i&lt;[appDelegate.notesArray count]; i++) { 
        UploadView *uploadview = (UploadView *)self.view; 
        if (uploadview != nil) 
        { 
            NSString * aString = [[NSString alloc] initWithString:[appDelegate.notesArray objectAtIndex:i]] ;
            //[m_owner uploadString:aString]; 
             [m_owner performSelector:@selector(uploadString:) withObject:aString afterDelay:i*20];
        } 
        if (selected[i]) 
            [str appendFormat:@"%@ ,",[appDelegate.notesArray objectAtIndex:i]]; 
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Selected Values" message:str delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];

    }


}
</code></pre>
