oc 封装的基本提示框

2019-03-27  本文已影响0人  神一样的队友

#pragma mark 提示框

-(void)addActionTotitle:(NSString*)title withMessage:(NSString*)massage withActionTitle:(NSString*)actionTitle withActionTitle:(NSString*)actionTitle2 preferredStyle:(UIAlertControllerStyle)preferredStyle viewController:(UIViewController*)vc block:(void(^)(BOOLisdelea))isok{

    UIAlertController*alertController=[UIAlertControlleralertControllerWithTitle:titlemessage:massage        preferredStyle:(preferredStyle)];

    UIAlertAction *action=[UIAlertAction actionWithTitle:actionTitle style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {

        isok(YES);

    }];

    UIAlertAction *action2=[UIAlertAction actionWithTitle:actionTitle2 style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {

    }];

    [alertControlleraddAction:action];

    if(![actionTitle2isEqualToString:@""]) {

        [alertControlleraddAction:action2];

    }

    [vcpresentViewController:alertController animated:YES completion:nil];

}

上一篇下一篇

猜你喜欢

热点阅读