设置 UISerachBar 的背景 透明

for (UIView *subview in searchBar.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
[subview removeFromSuperview];
break;
}
}


如果想自定义背景样式
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"40-di.png"]];
[mySearchBar insertSubview:imageView atIndex:1];
[imageView release];


//改变搜索按钮文字

//改变UISearchBar取消按钮字体

for(id cc in [searchBar subviews])

{

if([cc isKindOfClass:[UIButton class]])

{

UIButton *btn = (UIButton *)cc;

[btn setTitle:@"搜索"forState:UIControlStateNormal];

}

}

你可能感兴趣的:(RAC)