iOS-UIAlertController简易封装

//提醒框封装方法
-(void)showAlertControllerWithMessage:(NSString *)message{
    UIAlertController *remindAV = [UIAlertController alertControllerWithTitle:@"提示" message:message preferredStyle:UIAlertControllerStyleAlert];
    [remindAV addAction:[UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:nil]];
    [self presentViewController:remindAV animated:YES completion:nil];
}
#pragma mark - 网络请求
-(void)getResult{
    //保证输入框不为空
    if (self.sourceFD.text.length == 0) {
        [self showAlertControllerWithMessage:@"请选择源币种"];
        return;
    }else if (self.targetFD.text.length == 0){
        [self showAlertControllerWithMessage:@"请选择目标币种"];
        return;
    }else if (self.amountFD.text.length == 0){
        [self showAlertControllerWithMessage:@"请选择兑换金额"];
        return;
    }
    //...在保证输入框都不为空的前提下进行网络请求


}

你可能感兴趣的:(iOS-UIAlertController简易封装)