Hi,
I am creating an iPhone application where I need to show a login screen for few minutes, hence I created the custom view and added to the custom view controller which is added to the window for display. Now at the same time I need to check for some background database so, I am creating that in separate delegate and while after database operation is in finished it gives an callback to the main thread to display the new screen. But the first view is never getting displayed and my application directly lands up in the new view. Please find below my code snippet,
(void)CheckForExistingData : (DatabaseSource *)theDatabaseConnection { BOOL isRecordExist = theDatabaseConnection.isrecordExist;
// Release the connection.... [theDatabaseConnection release]; theDatabaseConnection = nil;
if (isRecordExist == FALSE) {
textLabel.text = @"Preparing the application for first time use, please wait...."; [activityIndicator startAnimating]; [self setNeedsDisplay];
} else { // Now all categories are successfully downloaded, launch the category screen... sleep(2); // sleep for 1 second to allow to show the splash screen.... [self.viewController LaunchCategoryViewController:self]; }
}
Here CheckForExistingData is an callback mechanism which will be called from the other thread.