新建一个类继承自UISearchBar
然后在.m文件中实现:
- (void)layoutSubviews{
[super layoutSubviews];
for (UIView*view in self.subviews) {
for (UIView*subView in view.subviews) {
if ([subView isKindOfClass:[UITextField class]]) {
//你想要设置的高度
subView.frame = CGRectMake(5, 3, self.w-10, self.h-6);
}
}
}
}
网友评论