//
//  ALTextFieldEnterView.m
//  GMAlpha
//
//  Created by Mikasa on 2018/11/23.
//  Copyright © 2018 Gengmei. All rights reserved.
//

#import "ALTextFieldEnterView.h"

@interface ALTextFieldEnterView()
@end
@implementation ALTextFieldEnterView

- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title {
    if (self = [super init]) {
        
        if ([title isNonEmpty]) {
            UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 36, frame.size.height)];
            GMLabel *titleLabel = [GMLabel labelWithTextColor:RGBCOLOR_HEX(0x999999)
                                                     fontSize:16];
            titleLabel.text = title;
            titleLabel.frame = leftView.bounds;
            [leftView addSubview:titleLabel];
            self.leftView = leftView;
        }
        
        self.textColor = RGBCOLOR_HEX(0x282828);
        self.font = [UIFont gmFont:16];
        self.textAlignment = NSTextAlignmentRight;
        self.leftViewMode = UITextFieldViewModeAlways;
        self.clearButtonMode = UITextFieldViewModeWhileEditing;
        
        [self addBottomLine];
    }
    return self;
}

/*
- (void)setup {
    
    UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 33)];
    GMLabel *titleLabel = [GMLabel labelWithTextColor:RGBCOLOR_HEX(0x999999)
                                             fontSize:16];
    [leftView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
//    GMTextField *enterField = [GMTextField new];
    self.textColor = RGBCOLOR_HEX(0x282828);
    self.font = [UIFont gmFont:16];
    self.leftView = leftView;
    self.leftViewMode = UITextFieldViewModeAlways;
    UIView *line = [self addBottomLine];
    
//    self.enterField = enterField;
    [self addBottomLine];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(0)
        make.width.mas_equalTo(20);
    }];
    
//    [self.enterField mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.top.bottom.mas_equalTo(0)
//        make.left.mas_equalTo(_titleLabel.mas_right);
//    }];
    
    
}
*/
@end
