【发布时间】:2016-03-22 15:26:35
【问题描述】:
我想在客户端选择标签栏上的搜索菜单时激活搜索栏并显示键盘。但是 resignfirstresponder 不起作用。你有其他建议吗?感谢您的认可。 这是在我的 viewdidload 方法中
[[UITextField appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTextColor:[UIColor grayColor]];
[[UITextField appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setBackgroundColor:[UIColor whiteColor]];
_searchBarNew.placeholder = [MCLocalization stringForKey:@"courses"];
_searchBarNew.backgroundImage = [UIImage imageNamed:@"grey_background"];
_searchBarNew.delegate = self;
【问题讨论】:
-
你想使用 resignfirstresponder 吗?
-
我用过但是不行
-
你需要调用 becomeFirstResponder 来使文本字段成为第一响应者。
-
uisearchBar 声明选择器成为fisrtresponder
标签: ios objective-c