there are two options for you according to me.
- Use an alertview
- Use MBProgressHUD.
For alertView You have to place a UIAlertView variable in .h file.
Then place following code - when you are requesting/loading 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, place following statement when you have finished your processing.
[av dismissWithClickedButtonIndex:0 animated:YES];
[av release]; av=nil;
- Another way is using MBProgressHUD
- It's very useful & ready made for you - you just have to follow these steps.
- Download it from given link
- Import Both file to your project ( copy not link )
#import "MBProgressHUD.h"
- import this where you want to use progress view.
MBProgressHUD *mbProcess;
- declare a variable in *.h file.
- Place following code when you are processing ( in *.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 done place this line.
[mbProcess hide:YES];
- Don't forget to add delegate method of MBProgressHUD in you *.m file. like this
#pragma mark -
#pragma mark MBProgressHUDDelegate methods
- (void)hudWasHidden {
// Remove HUD from screen when the HUD was hidded
[mbProcess removeFromSuperview];
[mbProcess release];
}