2011-05-09 2 views
0

У меня есть 4 вкладки в UITabBarcontroller. Моя проблема заключается в том, что мне нужно перейти к следующей вкладке щелчком пользователя, пока первая вкладка начнется в процессе? как запустить процесс на фоне?Как перемещаться по следующей вкладке во время просмотра первой вкладки?

Теперь вторая вкладка не работает во время просмотра первой вкладки. Я использовал PerformSelectorInBackground, но это не помогает мне ?? Кто-нибудь может мне помочь????

Неужели на английском, вы можете понять мою проблему?

Yuva.M

ответ

0

Выполнить свой тяжелый процесс с NSThread.

Отрывок из here:

- (IBAction) startThreadButtonPressed:(UIButton *)sender { 

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

} 

- (void)startTheBackgroundJob { 

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
    // wait for 3 seconds before starting the thread, you don't have to do that. This is just an example how to stop the NSThread for some time 
    [NSThread sleepForTimeInterval:3]; 
    [self performSelectorOnMainThread:@selector(makeMyProgressBarMoving) withObject:nil waitUntilDone:NO]; 
    [pool release]; 

} 

- (void)makeMyProgressBarMoving { 

    float actual = [threadProgressView progress]; 
    if (actual < 1) { 
     threadProgressView.progress = actual + 0.01; 
     [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(makeMyProgressBarMoving) userInfo:nil repeats:NO]; 
    } 

} 
+0

Спасибо дружище .. –

+0

Помогло ли это вам? –

+0

Я сохранил свой день. большое спасибо. –