弹窗

2020-06-20  本文已影响0人  iOS乐乐
#pragma mark-从底部到上的弹窗
-(void)alertAction{
    WS(weakSelf)
    //创建提示框控制器
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    //创建提示按钮
    UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
    }];
    UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"支付宝" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [weakSelf.TFArr replaceObjectAtIndex:0 withObject:@"支付宝"];
        [weakSelf.myTableView reloadData];
    }];
    UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"微信" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [weakSelf.TFArr replaceObjectAtIndex:0 withObject:@"微信"];
        [weakSelf.myTableView reloadData];
    }];
    UIAlertAction *action4 = [UIAlertAction actionWithTitle:@"银联支付" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [weakSelf.TFArr replaceObjectAtIndex:0 withObject:@"银联支付"];
        [weakSelf.myTableView reloadData];
    }];
    //添加提示按钮
    [alertController addAction:action1];
    [alertController addAction:action2];
    [alertController addAction:action3];
    [alertController addAction:action4];
    [self presentViewController:alertController animated:YES completion:nil];
}
上一篇下一篇

猜你喜欢

热点阅读