Problem in creating another thread

Posted by Avinash on Stack Overflow See other posts from Stack Overflow or by Avinash
Published on 2011-02-07T07:24:35Z Indexed on 2011/02/07 7:25 UTC
Read the original article Hit count: 162

Filed under:

Hi, I am using NSThread to create different thread and displaying images in my application on a new thread instead of main thread. On main thread i am working with a table view which is displaying data from XML file, In the same view I am displaying images below. But, displaying images on new thread is not working properly. Did i made any mistake in creating Here below is my code. Please help me its urgent. Thanks in advance......................

 - (void)viewDidLoad {

[super viewDidLoad];

 [NSThread detachNewThreadSelector:@selector(startTheBackgroundJob) toTarget:self withObject:nil];

}

- (void)startTheBackgroundJob {

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    currentLocationImageView = [[UIImageView alloc] init];
    NSArray *images = [NSArray arrayWithObjects:img1, img2, nil];
[currentLocationImageView setAnimationImages:images];
[currentLocationImageView setAnimationRepeatCount:0];
[currentLocationImageView setAnimationDuration:5.0];

    [self.view addSubview:currentLocationImageView];
    [pool release];

}

© Stack Overflow or respective owner

Related posts about iphone