//
//  CheckAlertViewController.m
//  XFFruit
//
//  Created by Javen on 2018/4/1.
//  Copyright © 2018年 Xummer. All rights reserved.
//

#import "CheckAlertViewController.h"

@interface CheckAlertViewController ()
@property (weak, nonatomic) IBOutlet UILabel *labelContent;
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintHeight;
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;

@end

@implementation CheckAlertViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    for (UIButton *view in self.alertCard.subviews) {
        if ([view isKindOfClass:[UIButton class]]){
            view.layer.cornerRadius = 4;
        }
    }
    // Do any additional setup after loading the view.
}

- (void)configWithContent:(NSString *)content isHasTextField:(BOOL)isHasTextField {
    [self layoutAlertView];
    
    if (!isHasTextField) {
        self.constraintHeight.constant = 140;
        self.textField.hidden = true;
    }
    self.labelTitle.backgroundColor = [UIColor redColor];
    self.labelContent.text = content;
}
- (IBAction)actionConfirm:(id)sender {
    [self.view endEditing:true];
    if (self.blockConfirm) {
        self.blockConfirm();
    }
    
}

- (NSString *)text {
    return self.textField.text;
}
- (IBAction)actionCancel:(id)sender {
    [self hide];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
