Thursday, 3 May 2012

change UI though secondary thread iphone

- (void) viewDidLoad{
   [NSThread detachNewThreadSelector:@selector(presentModal) toTarget:self withObject:nil];
}
- (void)presentModal{
//  usleep for micro time sleep this thread  I commented this
//    usleep(200000);
 
  dispatch_queue_t workerQueue = dispatch_queue_create("QueueIdentifier", NULL);
    dispatch_sync(workerQueue, ^ {
        // change in UI through secondary thread
        [self presentModalViewController:reader animated:NO];
    });
}

No comments:

Post a Comment