Show no button warning box for iPhone apps

Source: Internet
Author: User

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

 
 
  1. – dismissWithClickedButtonIndex:animated: 

The following code creates a non-button UIAlertView and disappears after 3 s.

 
 
  1. UIAlertView *baseAlert;  
  2.  
  3. - (void) action: (UIBarButtonItem *) item  
  4. {  
  5.     baseAlert = [[[UIAlertView alloc] initWithTitle:@"Please Wait" message:nil delegate:self 
  6. cancelButtonTitle:nil otherButtonTitles: nil] autorelease];  
  7.     [baseAlert show];  
  8.  
  9. // Create and add the activity indicator  
  10. UIActivityIndicatorView *aiv = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];  
  11. aiv.center = CGPointMake(baseAlert.bounds.size.width / 2.0f, baseAlert.bounds.size.height - 40.0f);  
  12. [aiv startAnimating];  
  13. [baseAlert addSubview:aiv];  
  14. [aiv release];  
  15.  
  16.  
  17. // Auto dismiss after 3 seconds  
  18. [self performSelector:@selector(performDismiss) withObject:nil afterDelay:3.0f];  
  19. }  
  20.  
  21. - (void) performDismiss  
  22. {  
  23.     [baseAlert dismissWithClickedButtonIndex:0 animated:NO];  

The effect is as follows:

Summary:IPhone DevelopmentShow no buttons for ApplicationsWarning boxI hope this article will help you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.