美文网首页
iOS UIsearchBar 修改右侧 cancel

iOS UIsearchBar 修改右侧 cancel

作者: WS_0909 | 来源:发表于2017-05-04 10:21 被阅读0次
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{
    searchBar.showsCancelButton = YES;
    for(UIView *view in  [[[searchBar subviews] objectAtIndex:0] subviews]) {
        if([view isKindOfClass:[NSClassFromString(@"UINavigationButton") class]]) {
            UIButton * cancel =(UIButton *)view;
            [cancel setTitle:@"搜索" forState:UIControlStateNormal];
            cancel.titleLabel.font = [UIFont systemFontOfSize:14];
        }
    }
}

相关文章

网友评论

      本文标题:iOS UIsearchBar 修改右侧 cancel

      本文链接:https://www.haomeiwen.com/subject/mwertxtx.html