IPhone DevelopmentShow no buttons for ApplicationsWarning boxIs the content to be introduced in this article, mainly aboutWarning boxLet's take a look at the implementation of the case. To display asynchronous information that does not require user interaction, you can create a UIAlertView without buttons.
Generally, a warning box without buttons has a feature that does not automatically disappear. Therefore, the warning box will disappear after we finish the task. You can call this method
- – dismissWithClickedButtonIndex:animated:
The following code creates a non-button UIAlertView and disappears after 3 s.
- UIAlertView *baseAlert;
-
- - (void) action: (UIBarButtonItem *) item
- {
- baseAlert = [[[UIAlertView alloc] initWithTitle:@"Please Wait" message:nil delegate:self
- cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
- [baseAlert show];
-
- // Create and add the activity indicator
- UIActivityIndicatorView *aiv = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
- aiv.center = CGPointMake(baseAlert.bounds.size.width / 2.0f, baseAlert.bounds.size.height - 40.0f);
- [aiv startAnimating];
- [baseAlert addSubview:aiv];
- [aiv release];
-
-
- // Auto dismiss after 3 seconds
- [self performSelector:@selector(performDismiss) withObject:nil afterDelay:3.0f];
- }
-
- - (void) performDismiss
- {
- [baseAlert dismissWithClickedButtonIndex:0 animated:NO];
- }
The effect is as follows:
Summary:IPhone DevelopmentShow no buttons for ApplicationsWarning boxI hope this article will help you!