- (void)layoutSubviews{
[super layoutSubviews];
for (UIView *view in self.subviews)
{
if ([view isKindOfClass:NSClassFromString(@"UIView")] && view.subviews.count > 0) {
for (UIView *subview in view.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"UITextField")]) {
UITextField *textField = (UITextField *)subview;
CGRect frame = textField.frame;
frame.size.height = 40;
textField.frame = frame;
textField.tintColor = [UIColor grayColor];
//光标
textField.font = [UIFont systemFontOfSize:16.0];
textField.textColor = [UIColor grayColor];
textField.backgroundColor = [UIColor colorWithRed:0.96 green:0.96 blue:0.96 alpha:1];
textField.layer.cornerRadius = 14.f;
textField.layer.masksToBounds = YES;
//放大镜
UIImageView * image = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 18, 18)];
image.image = [UIImage imageNamed:@"quanzi_searchIcon"];
image.backgroundColor = [UIColor clearColor];
textField.leftView = image;
break;
}
}
break;
}
}
}
网友评论