UISearchController使用中遇到的各种问题

UISearchController使用中遇到的各种问题

2023年7月13日发(作者:)

UISearchController使⽤中遇到的各种问题⾸先初始化,这就不细说了,三个代理都写上: _ResultsUpdater = self; _te = self; _te = self;⼀、⾃动弹出键盘以往的写法:- (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; = true;}- (void)didPresentSearchController:(UISearchController *)searchController { [Bar becomeFirstResponder];}实现如上的代码就可以了,但是如果把searchbar写到导航条上,发现这么写完全是没作⽤的。修改:- (void)didPresentSearchController:(UISearchController *)searchController { [UIView animateWithDuration:0.1 animations:^{} completion:^(BOOL finished) { [Bar becomeFirstResponder]; }];}⼆、搜索输⼊时禁⽌searchBar上移隐藏导航条 _avigationBarDuringPresentation = NO;三、修改searchBar取消按钮的颜⾊和⽂字 [[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTintColor:[UIColor whiteColor]]; [[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTitle:@"取消"];四、显⽰searBar的光标(如果不显⽰可以这么设置) _lor = [UIColor blueberryColor];

发布者:admin,转转请注明出处:http://www.yc00.com/web/1689262636a226330.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信