如何修改 UISearchbar 的 UITextField 左边的放大镜
1个回答
展开全部
UITextField* searchField = nil;
for (UIView* subview in_searchBar.subviews) {
if ([subview isKindOfClass:[UITextFieldclass]]) {
searchField = (UITextField*)subview;
break;
}
}
if (searchField) {
//searchField.frame = CGRectMake(0, 0, 50, 50);
UIImage *image = [UIImageimageNamed: @"searchIcon"];
UIImageView *iView = [[UIImageViewalloc] initWithImage:image];
iView.frame = CGRectMake(0, 0, image.size.width , image.size.height);
UIView *myview = [[UIViewalloc]initWithFrame:CGRectMake(0, 0, 40 , 60)];
searchField.leftView = myview;
}
for (UIView* subview in_searchBar.subviews) {
if ([subview isKindOfClass:[UITextFieldclass]]) {
searchField = (UITextField*)subview;
break;
}
}
if (searchField) {
//searchField.frame = CGRectMake(0, 0, 50, 50);
UIImage *image = [UIImageimageNamed: @"searchIcon"];
UIImageView *iView = [[UIImageViewalloc] initWithImage:image];
iView.frame = CGRectMake(0, 0, image.size.width , image.size.height);
UIView *myview = [[UIViewalloc]initWithFrame:CGRectMake(0, 0, 40 , 60)];
searchField.leftView = myview;
}
东莞大凡
2024-11-14 广告
2024-11-14 广告
标定板认准大凡光学科技,专业生产研发厂家,专业从事光学影像测量仪,光学投影测量仪.光学三维测量仪,光学二维测量仪,光学二维测量仪,光学三维测量仪,光学二维测量仪.的研发生产销售。东莞市大凡光学科技有限公司创立于 2018 年,公司总部坐落于...
点击进入详情页
本回答由东莞大凡提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询