//Display an Activity Indicator
-(void) displayActivityIndicator {
// Set position for activityIndicator
[self setActivityIndicatorPosition];
[waitView setImage:[UIImage imageNamed:@"WaitScreen.png"]];
activityIndicator= [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge];
[activityIndicator setFrame:CGRectMake(86,30,30,30)];
[activityIndicator startAnimating];
[waitView addSubview: activityIndicator];
[self.view] addSubview:waitView];
[activityIndicator startAnimating];
//Ignore interaction for background activities
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
}
#pragma mark -
#pragma mark setActivityIndicatorPosition
-(void) setActivityIndicatorPosition {
CGRect screenSize = [[UIScreen mainScreen] bounds];
if( ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ( [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) {
[waitView setFrame:CGRectMake(x,y,203,73)];
}
if(([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft ) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight)) {
[waitView setFrame:CGRectMake(x1,y1,203,73)];
}
}
//Hide Activity Indicator
-(void) hideActivityIndicator {
//Hide waitView
[waitView setImage:[UIImage imageNamed:nil]];
[activityIndicator stopAnimating];
if ([[UIApplication sharedApplication] isIgnoringInteractionEvents]) {
// Start interaction with application
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
}
}
No comments:
Post a Comment