最近遇到要重写的事情,那么就从UITextField开始吧。。
首先,先列举几个我要重写的属性。
A.self.borderStyle == 用来标示UITextField的类型
typedef enum {
UITextBorderStyleNone,
UITextBorderStyleLine,
UITextBorderStyleBezel,
UITextBorderStyleRoundedRect
} UITextBorderStyle;
B.self.textAlignment == 用来标示UITextField里面的字体的位置
enum {
NSTextAlignmentLeft = 0,
NSTextAlignmentCenter = 1,
NSTextAlignmentRight = 2,
NSTextAlignmentJustified = 3,
NSTextAlignmentNatural = 4,
};
C.self.contentVerticalAlignment == 这个用到的比较多。让UITextField里面的字体居中显示
typedef NS_ENUM(NSInteger, UIControlContentVerticalAlignment) {
UIControlContentVerticalAlignmentCenter = 0,
UIControlContentVerticalAlignmentTop = 1,
UIControlContentVerticalAlignmentBottom = 2,
UIControlContentVerticalAlignmentFill = 3,
};
暂时用到这么多,欢迎批评改正。