-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUITextField+LJExtension.m
38 lines (29 loc) · 1.1 KB
/
UITextField+LJExtension.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// UITextField+LJExtension.m
// LovedEveryMonth
//
// Created by ljcoder on 2017/5/2.
// Copyright © 2017年 OldFriend. All rights reserved.
//
#import "UITextField+LJExtension.h"
@implementation UITextField (LJExtension)
+ (instancetype)lj_textFieldWithPlaceholder:(NSString *)placeholder {
return [UITextField lj_textFieldWithPlaceholder:placeholder leftView:nil rightView:nil];
}
+ (instancetype)lj_textFieldWithPlaceholder:(NSString *)placeholder leftView:(UIView *)leftView {
return [UITextField lj_textFieldWithPlaceholder:placeholder leftView:leftView rightView:nil];
}
+ (instancetype)lj_textFieldWithPlaceholder:(NSString *)placeholder leftView:(UIView *)leftView rightView:(UIView *)rightView {
UITextField *textField = [[UITextField alloc] init];
textField.placeholder = placeholder;
if (leftView) {
textField.leftView = leftView;
textField.leftViewMode = UITextFieldViewModeAlways;
}
if (rightView) {
textField.rightView = rightView;
textField.rightViewMode = UITextFieldViewModeAlways;
}
return textField;
}
@end