美文网首页
29、UISearchController 的 cancel 按

29、UISearchController 的 cancel 按

作者: 天听云道 | 来源:发表于2016-08-09 09:30 被阅读123次
//----
searchController.delegate = self;

// --searchbar的代理方法
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
    // --取消按钮
    searchBar.showsCancelButton = YES;
    UIButton *btn = [searchBar valueForKey:@"_cancelButton"];
    [btn setTitle:@"取消" forState:UIControlStateNormal];
    return YES;
}

相关文章

网友评论

      本文标题:29、UISearchController 的 cancel 按

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