怎么改变uisearchbar中的cancel按钮的文字
2个回答
展开全部
有办法 在 这个代函数里面 遍历就可以了
运行方法如下:
- (void)searchBarTextDidBeginEditing:(UISearchBar *)hsearchBar
{
searchBar.showsCancelButton = YES;
for(id cc in [searchBar subviews])
{
if([cc isKindOfClass:[UIButton class]])
{
UIButton *btn = (UIButton *)cc;
[btn setTitle:@"取消" forState:UIControlStateNormal];
}
}
}
UISearchBar也是iOS开发常用控件之一,点进去看看里面的属性barStyle、text、placeholder等等。但是这些属性显然不 足矣满足开发需求。比如:修改placeholder的颜色、修改UISearchBar上面的UITextfield的背景颜色、修改 UITextfield上面的照片等等。
运行方法如下:
- (void)searchBarTextDidBeginEditing:(UISearchBar *)hsearchBar
{
searchBar.showsCancelButton = YES;
for(id cc in [searchBar subviews])
{
if([cc isKindOfClass:[UIButton class]])
{
UIButton *btn = (UIButton *)cc;
[btn setTitle:@"取消" forState:UIControlStateNormal];
}
}
}
UISearchBar也是iOS开发常用控件之一,点进去看看里面的属性barStyle、text、placeholder等等。但是这些属性显然不 足矣满足开发需求。比如:修改placeholder的颜色、修改UISearchBar上面的UITextfield的背景颜色、修改 UITextfield上面的照片等等。
展开全部
- (void)searchBarTextDidBeginEditing:(UISearchBar *)hsearchBar
{
searchBar.showsCancelButton = YES;
for(id cc in [searchBar subviews])
{
if([cc isKindOfClass:[UIButton class]])
{
UIButton *btn = (UIButton *)cc;
[btn setTitle:@"取消" forState:UIControlStateNormal];
}
}
}
{
searchBar.showsCancelButton = YES;
for(id cc in [searchBar subviews])
{
if([cc isKindOfClass:[UIButton class]])
{
UIButton *btn = (UIButton *)cc;
[btn setTitle:@"取消" forState:UIControlStateNormal];
}
}
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询