- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *KeyCor;
NSString *YKeyCor;
NSString *DesName;
Service *aService;
aService = [appDelegate.blocks objectAtIndex:indexPath.row];
KeyCor=[aService xcoordinate];
YKeyCor=[aService ycoordinate];
DesName=[aService name];
Service *s = [[Service alloc] initWithLat:YKeyCor andLong:KeyCor andName:DesName];
MapViewController *mvController = (MapViewController *)[MapViewController sharedInstance];
mvController.view.alpha = 1;
//[self.navigationController pushViewController:mvController animated:YES];
[mvController showMarkingOnMap:s];
//self.searchBarCancelButtonCLicked; <--- fail
///
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
sBar.showsCancelButton = NO;
[tableData removeAllObjects];
[tableData addObjectsFromArray:dataSource];
[searchBar resignFirstResponder];
sBar.text = @"";
[myTableView removeFromSuperview];
}
答案 0 :(得分:3)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
...
[self searchBarCancelButtonClicked:whateverYouNamedYourSearchbar];
}