自定义UISearchiBar
来源:互联网 发布:凯里欧文16年数据 编辑:程序博客网 时间:2024/06/03 22:41
1、
@interface MySearchBar :UISearchBar
@end
2、
@implementation MySearchBar
-(void)layoutSubviews
{
[superlayoutSubviews];
UITextField *searchTextField=nil;
NSArray *subViewArr=self.subviews;
for (NSInteger i=0; i<subViewArr.count; i++) {
UIView *viewSub=[subViewArr objectAtIndex:i];
NSArray *arr=viewSub.subviews;
for (NSInteger j=0; j<arr.count; j++) {
if ([[arr objectAtIndex:j]isKindOfClass:[UITextFieldclass]]) {
searchTextField=(UITextField *)[arrobjectAtIndex:j];
}
}
}
if (!(searchTextField==nil)) {
[searchTextFieldsetBackgroundColor:[UIColorwhiteColor]];
searchTextField.placeholder=@"请输入品牌名称";
[searchTextField setBorderStyle:UITextBorderStyleRoundedRect];
UIImageView *imageView=[[UIImageViewalloc] initWithImage:[UIImageimageNamed:@"gray-Textfieldsearch"]];
searchTextField.leftView=imageView;
}
}
@end
- 自定义UISearchiBar
- 自定义
- 自定义
- 自定义
- 自定义
- 自定义
- 自定义TexBox,自定义ComboBox
- 自定义View自定义属性
- 自定义View自定义属性
- 自定义View自定义属性
- 自定义View自定义属性
- 自定义一个自定义对话框
- 自定义控件-自定义吐司
- 自定义checkbox,自定义button
- 自定义控件--自定义对话框
- 自定义控件----自定义属性
- 自定义控件:自定义Toast
- 自定义View自定义属性
- java查询优化
- Python logging(配置实现)
- 鼠标悬浮 边框动态出来特效
- [深入ReactNative]第一篇 通讯及消息循环代码剖析
- HDU 5606 tree(并查集)
- 自定义UISearchiBar
- Python集合(set)类型的操作
- jqGrid增删改查显示——显示+nodejs后台
- java.lang.IllegalStateException: Fragment(XXFragment) not attached to Activity异常。
- 如何定义XSD并在XML中使用XSD
- 《Linux命令、编辑器与Shell编程》读书笔记9-Linux网络管理
- Java AQS源码分析
- 计算机网络学习——网络安全
- Android Studio 设置代码提示和代码自动补全快捷键--Eclipse 风格