I have app in which if there is data in local data base then it will first upload it to server before starting the application i have written the upload code in app Deleage I want that while uploading is going on how to show activiy indicator with alert.
Normally it is easy to show to startAnimating and Stop, but how to do in this scenario?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self copyDatabaseIfNeeded];
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
self.coffeeArray = tempArray;
[tempArray release];
[Coffee checkData:[self getDBPath]];
int mytestcount=rowCount;
NSLog(@"My Test ROw Count IS %d",mytestcount);
if (mytestcount=0) {
NSLog("No Data To Upload");
}
else {
[Coffee getInitialDataToDisplay:[self getDBPath]];
[self uploadData];
}
[self.window addSubview:[navigationController view]];
[self.window makeKeyAndVisible];
return YES;
}
Displaying
UIActivityIndicatorfor this operation requires putting it in didFinishLaunchingWithOptions of appDelegate. Perform uploading in different thread so that indicator is displayed as long as operation is carried out. The change will be as follows :Creating a
UIActivityIndicatorin an alert is not difficult task. You can do it as follows :You can customize your alert as you like it to be.
Hope this helps.