草庐IT

UIsearchBar

全部标签

iphone - 当用户停止输入 UISearchBar 时检测暂停

我有以下UISearchbar代码:-(void)searchBar:(UISearchBar*)searchBartextDidChange:(NSString*)searchText{NSTimer*myTimer;NSLog(@"Timer=%@",myTimer);if(myTimer){if([myTimerisValid]){[myTimerinvalidate];}myTimer=nil;}myTimer=[NSTimerscheduledTimerWithTimeInterval:2.0target:selfselector:@selector(OnTextChange

ios - UISearchBar 提示在导航栏中时没有动画

2014年3月25日更新看起来缺少动画是iOS7.0中的一个错误,并已在iOS7.1中修复。原始问题通常,当您在iOS7中点击搜索栏内部时,它会出现一个漂亮的小动画,其中放大镜和“搜索”文本会从搜索栏中间滑到左侧。但是,如果我将搜索栏放在导航栏中而不是TableView中,它就不再具有动画效果。相反,放大镜和“搜索”文本会立即跳到搜索栏的左侧。您可以使用Apple的UISearchBarsampleproject非常轻松地看到这一点.打开Storyboard。在搜索显示Controller上添加bool运行时属性displaysSearchBarInNavigationBar,并选中它

ios - 如何在 UISearchBar 激活时隐藏 UIRefreshControl?

我有一个支持下拉刷新和搜索(分开)的tableview。如果我下拉刷新,然后立即点击搜索栏,如何隐藏refreshControl? 最佳答案 目前我找到的最佳解决方案是在搜索栏处于事件状态时完全禁用刷新。@property(nonatomic,strong)UIRefreshControl*refreshControl;....-(BOOL)searchBarShouldBeginEditing:(UISearchBar*)searchBar{//Disablerefreshcontrolself.refreshControl=se

ios - 如何为 UISearchBar IOS 添加 accessibilitylabel

self.searchbar.isAccessibilityElement=YES;self.searchbar.accessibilityLabel=@"searchbar";self.searchbar.accessibilityHint=@"searchbar";self.searchbar.accessibilityElementsHidden=NO;我为ViewDidLoad中的UISearchbarsocket添加了上面的代码。不幸的是,辅助功能标签没有显示。我对所有UIelements使用了上面的代码,除了UISearchbar之外工作正常。我们必须为UISearchba

ios - 带有 UIStoryboard 的 UISearchbar : segues and custom cells do not work correctly

我正在使用Storyboard并想为我的UITableView实现一个UISearchbar。UISearchbarController生成一个新的UITableView,我使用以下策略:if(tableView==self.tableView)//Populatetableviewwithnormaldataelse//Populatetableviewwithsearchdata第一个问题是处理自定义单元格。我必须在cellForRowAtIndexPath中实例化它们。通常你会从一个nib文件中做到这一点。我如何使用Storyboard来做到这一点?dequeueReusable

ios - UISearchBar 失去焦点

我有一个UITableView的UISearchBar,我的实现如下:-(void)searchBar:(UISearchBar*)searchBartextDidChange:(NSString*)searchText{[self.searchBarbecomeFirstResponder];if(searchText.length==0){self.isFiltered=NO;}else{NSPredicate*predicate=[NSPredicatepredicateWithFormat:@"SELF.writer1contains[c]%@",searchText];sel

ios - 将搜索字符串从 UISearchBar 转换为 MK MapView 地址

将UISearchBar添加到我的MK-MapView并使用UISearchBar中写入的搜索字符串在map上获取地址。后面还得能把map上标示的地址转换成NSString!你能帮我吗?我在谷歌上搜索,但我什么都不懂!请帮助我..我使用了这个项目,但是当我运行搜索时,map仍然是同一个点:projectthatIused 最佳答案 您可以引用以下链接找到mapView搜索a/c到这些地方的示例代码......https://developer.apple.com/library/ios/samplecode/MapSearch/In

ios - 更改文本后无法更改 UISearchBar 取消按钮标题颜色。

我正在使用此代码更改UISearchBar取消按钮标题:-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController*)controller{self.searchDisplayController.searchBar.showsCancelButton=YES;UIView*view=_otsinguRiba.subviews[0];for(UIView*subViewinview.subviews){if([subViewisKindOfClass:[UIButtonclass]]){UIButto

ios - UISearchBar barTintColor 没有隐藏在 iOS 7.1 中

在我的应用中,我在自定义UIView中使用UISearchBar。以下是显示UISearchBar的代码。searchBar=[[UISearchBaralloc]initWithFrame:CGRectMake(50,135,230,32)];searchBar.barTintColor=[UIColorclearColor];searchBar.placeholder=@"Search";[selfaddSubview:searchBar];在iOS7.0.3中,bartint颜色不显示,但是在iOS7.1中,bartint颜色不会隐藏。 最佳答案

iphone - objective-c 中UINavigationBar右侧的UISearchBar

我创建了一个iPad应用程序,我希望在其中将我的searchBar定位在导航栏的右侧。当我在导航栏中添加搜索栏时,它位于导航栏的中间。相反,我想在中间显示特定图像。我怎样才能做到这一点?这是我的代码片段,[self.navigationController.navigationBarsetTintColor:[[UIColoralloc]initWithRed:150.0/255green:22.0/255blue:22.0/255alpha:0.0]];UIImage*image=[UIImageimageNamed:@"logo(1).png"];UIImageView*image