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