使使用 AlertView 而不必使用实例变量在 iOS 和 tvOS 中变得非常容易。
[AlertViewBlocks confirmWithTitle:@"Title" message:@"your message here"
confirm:^{
NSLog(@"Ok button selected!");
} cancel:^{
NSLog(@"Cancel button selected!");
}];
[AlertViewBlocks confirmWithTitle:@"Title" message:@"your message here"
YesNo:YES confirm:^{
NSLog(@"Yes button selected!");
} cancel:^{
NSLog(@"No button selected!");
}];
[AlertViewBlocks alertWithTitle:@"Title" message:@"you message here" confirm:^(NSInteger index) {
NSLog(@"Button #%i selected!", index);
} cancel:^{
NSLog(@"Cancel button selected!");
} otherButtonTitles:@"Button 1", @"Button 2", @"Button 3", nil];