我需要searchDisplayController的帮助。现在我使用的是带有textDidChange的searchDisplayController,但是每当我按下search或在一行上搜索文本时,我的搜索文本就会从searchBar中删除。之后,它返回到textDidChange,我用一个空字符串执行我的代码。有人能帮帮我吗?
提前感谢
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
if(connectionStatus.boolNoConnection||connectionStatus.boolErrorConnection)
{
[self.searchDisplayController setActive:NO animated:YES];
MKCoordinateSpan span;
span.latitudeDelta = 2.5f;
span.longitudeDelta = 2.5f;
CLLocationCoordinate2D location;
location.latitude = 52.30;
location.longitude = 5.45;
MKCoordinateRegion region;
region.span = span;
region.center = location;
[map setRegion:region animated:YES];
}
else {
if (![geoArray count] == 0) {
[map removeAnnotations:pins];
[pins release];
[pinPlacemark removeAllObjects];
[self readArray:geoArray];
[self.searchDisplayController setActive:NO animated:YES];
}
}
}我只在这里调用searchdisplaycontroller,没有在其他地方调用。
发布于 2010-12-07 06:59:48
我肯定需要看到你的代码,但从我所读到的来看,没有必要改变搜索文本。检查您的代码,看看您是否正在调用[[self searchDisplayController searchBar] setText:XXX]。这允许您在不运行搜索的情况下修改搜索栏中的文本。
https://stackoverflow.com/questions/4265508
复制相似问题