I have a NSURL which takes a huge time to load the url, I need to show a spinner, I am using the below code, but the spinner is the not the first thing which appears it shows a black screen first, I want the app to load the spinner first as it launches till the URL is loaded completed, Can anyone please help on this, It would be greatly appreciated.
[NSThread detachNewThreadSelector:@selector(showLoading) toTarget:self withObject:nil];
NSURL *URL = [NSURL URLWithString:@"http://strappcenter.net/strapp-projects/ohs/admin/jsonstring.php"];
//NSURL *URL = [NSURL URLWithString:@"http://strappcenter.net/strapp-projects/ohs/admin/jsonstring.php"];
NSError *error;
NSString *stringFromFileAtURL = [[NSString alloc]
initWithContentsOfURL:URL
encoding:NSUTF8StringEncoding
error:&error];
[NSThread detachNewThreadSelector: @selector(spinEnd) toTarget:self withObject:nil];
You need to add the splash screen which is just like your first screen.
Then load the data from the internet.
Check out this tutorial.