for me there are two options.
- Use alertview
- Use MBProgressHUD.
For alertView, you must put the UIAlertView variable in the .h file. Then put the following code - when you request / load data.
av=[[UIAlertView alloc] initWithTitle:@"Loading Data" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
ActInd=[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[ActInd startAnimating];
[ActInd setFrame:CGRectMake(125, 60, 37, 37)];
[av addSubview:ActInd];
[av show];
Now, after processing is complete, place the following statement.
[av dismissWithClickedButtonIndex:0 animated:YES];
[av release]; av=nil;
- Another way: MBProgressHUD
- This is very useful and ready for you - you just need to follow these steps.
- Download it from the specified link
- Import both files into your project (copy no link)
#import "MBProgressHUD.h" - import this when you want to use the progress view.MBProgressHUD *mbProcess; - declare a variable in the * .h file.- Put the following code during processing (in the * .m file)
mbProcess=[[MBProgressHUD alloc] initWithView:self.view];
mbProcess.labelText=@ "Loading Data";
[self.view addSubview:mbProcess];
[mbProcess setDelegate:self];
[mbProcess show:YES];
- When your processing is complete, put this line.
[mbProcess hide:YES]; - Do not forget to add the MBProgressHUD delegation method to your * .m file. like this
#pragma mark -
#pragma mark MBProgressHUDDelegate methods
- (void)hudWasHidden {
source share