Iphone 创建另一个线程时出现问题

Iphone 创建另一个线程时出现问题,iphone,multithreading,Iphone,Multithreading,我正在使用NSThread创建在应用程序中显示图像的新线程。在主线程上,我正在使用一个表视图,该视图显示XML文件中的数据,在同一视图中,我正在显示下面的图像。但是,在新线程上显示图像无法正常工作 - (void)viewDidLoad { [super viewDidLoad]; [NSThread detachNewThreadSelector:@selector(startTheBackgroundJob) toTarget:self withObject:nil]; }

我正在使用
NSThread
创建在应用程序中显示图像的新线程。在主线程上,我正在使用一个表视图,该视图显示XML文件中的数据,在同一视图中,我正在显示下面的图像。但是,在新线程上显示图像无法正常工作

- (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];
}

现在你已经开始接受答案了


甚至不用看代码,首先要告诉您的是,您必须在主线程上执行UI活动。。。有关详细信息…

如果您有急事,则不感兴趣。我不急。这里的每个人做任何事都不要钱,也许只是为了代表。但你甚至不接受答案,所以没有人会帮助你。@avinash set[currentLocationImageView setAnimationDuration:2.0];低。你不需要使用线程来制作这个简单的动画。我在mainthread中说。也可以将repeatcount设置为-1,用于repeat foreverI。我正在主线程上执行UI活动,但触摸速度很慢。有人能帮我吗??