创建一个按钮之后,直接进行调用以下的点击事件
-(void)actionButton:(UIButton*)btn
{
UIAlertController*act =[UIAlertController alertControllerWithTitle:nil message:@"ddd" preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction*okact =[UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"ok");
}];
UIAlertAction*cacel =[UIAlertAction actionWithTitle:@"cacel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"取消");
}];
[act addAction:okact];
[act addAction:cacel];
[self presentViewController:act animated:YES completion:nil];
在block进行相应事件的调用、填写