代码块集成设置UITextField属性

来源:互联网 发布:淘宝农村服务站 编辑:程序博客网 时间:2024/05/17 02:34

如果是多个UITextField时不用一个个进行设置


.h文件

@property (weak, nonatomic)IBOutlet UITextField *textSpeed;

@property (weak, nonatomic)IBOutlet UITextField *textField;

@property (weak, nonatomic)IBOutlet UITextField *textDelta;


.m文件

[@[_textDelta,_textField, _textShakes, _textSpeed]enumerateObjectsUsingBlock:^(UITextField* obj,NSUInteger idx, BOOL *stop) {

[obj.layersetBorderWidth:2];

[obj.layersetBorderColor:[UIColorcolorWithRed:49.0/255.0green:186.0/255.0blue:81.0/255.0alpha:1].CGColor];

[obj setDelegate:self];

}];



0 0