Created
August 9, 2010 04:59
-
-
Save marshluca/514960 to your computer and use it in GitHub Desktop.
Add UIActivityIndicatorView or UIProgressView to UIAlertView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// display the alert view | |
- (void)createProgressionAlertWithTitle:(NSString *)title message:(NSString *)message andIsActivity:(BOOL)isActivity | |
{ | |
UIAlertView *progressAlert = [[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:nil otherButtonTitles:nil]; | |
// Create the progress bar and add it to the alert | |
if (isActivity) | |
{ | |
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; | |
activityView.frame = CGRectMake(139.0f-18.0f, 60.0f, 37.0f, 37.0f); | |
[progressAlert addSubview:activityView]; | |
[activityView startAnimating]; | |
} else | |
{ | |
UIProgressView *progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(30.0f, 80.0f, 225.0f, 90.0f)]; | |
[progressAlert addSubview:progressView]; | |
[progressView setProgressViewStyle: UIProgressViewStyleBar]; | |
} | |
[progressAlert show]; | |
[progressAlert release]; | |
} | |
// dismiss the alert view | |
- (void)dismissProgressAlert { | |
[progressAlert dismissWithClickedButtonIndex:0 animated:YES]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment