开发者

How to navigate next tab while first tab view in process?

I have 4 tabs in UITabBarcontroller. My problem is i need to navigate to next tab by user click while first tab process in on going?? how to ru开发者_如何转开发n the process on background??

Now second tab not working while the first tab view in process. I used PerformSelectorInBackground but it's not help me?? Can any one help me Please????

Am poor in english, can you understand my problem?

Yuva.M


Run your heavy process with NSThread.

Snippet from 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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜