Use of AlertView + Block, alertviewblock

Source: Internet
Author: User

Use of AlertView + Block, alertviewblock

AlertView is frequently used. It seems that it is not so ugly After flattening, but so far, the official website still uses Delegate to handle click events, which affects the readability of the program.

If Block is used, it will be clear at a glance. I wanted to write one, but it was too lazy (in fact, it's not okay ....).

Of course, the omnipotent Git is certainly available, and it is easy to find it. The usage is as follows:

1 [[[UIAlertView alloc] initWithTitle: @ "prompt" message: @ "the current network is a mobile network, there will be a traffic fee (• too many others have been transferred). Do you want to watch the video? "CancelButtonItem: nil 2 3 otherButtonItems: 4 [RIButtonItem itemWithLabel: @" no "action: ^ {5 [SingleZHVideoPlayer success]; 6}], 7 [RIButtonItem itemWithLabel: @ "Continue play" action: ^ {8 [SingleZHVideoPlayer playContent]; 9}] 10, [RIButtonItem itemWithLabel: @ "I am a local tyrant, don't bother me in the future" action: ^ {11 // VOD 12 [SingleZHVideoPlayer playContent]; 13 [ZHAppManager sharedInstance]. notAutoAlert2g =! [ZHAppManager sharedInstance]. notAutoAlert2g; 14 [[NSUserDefaults standardUserDefaults] setBool: [ZHAppManager sharedInstance]. notAutoAlert2g forKey: shard]; 15 16}], nil] show]

 

 

 

 

I don't have to worry about writing a proxy anymore.

Git address

UIAlertView-Blocks

  

Related Article

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.