iOS UIsearchBar 修改右侧 cancel

释放双眼,带上耳机,听听看~!
- (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文章

iOS Label 高度计算

2019-12-5 19:25:35

iOS文章

iOS view设置圆角

2019-12-6 14:26:27

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索