我搜索了幾個小時,我發現沒有什麼是否有人知道如何使用UISearchBar在MKMapView上搜索註釋?
而且誰能告訴我,如果他們知道如何將一個細胞在分組的UITableView鏈接到某個特定的DetailView和不同的單元格鏈接到其他的DetailView?
我搜索了幾個小時,我發現沒有什麼是否有人知道如何使用UISearchBar在MKMapView上搜索註釋?
而且誰能告訴我,如果他們知道如何將一個細胞在分組的UITableView鏈接到某個特定的DetailView和不同的單元格鏈接到其他的DetailView?
對於地圖,我會在哪裏放置搜索代碼,以及如果這是我的註釋。
- (void)viewDidLoad {
[super viewDidLoad];
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
// Central Alabama Chapter
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 33.45606;
region.center.longitude = -86.83078;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[mapView setRegion:region animated:YES];
[mapView setDelegate:self];
DisplayMap *ann = [[DisplayMap alloc] init];
ann.title = @"Central Alabama Chapter";
ann.subtitle = @"721 Hillmoor Lane Homewood, Alabama 35209";
ann.coordinate = region.center;
[mapView addAnnotation:ann];
// Walnut Ridge Fire Department
MKCoordinateRegion region1 = { {0.0, 0.0 }, { 0.0, 0.0 } };
region1.center.latitude = 36.11493;
region1.center.longitude = -90.95695;
region1.span.longitudeDelta = 0.01f;
region1.span.latitudeDelta = 0.01f;
DisplayMap *ann1 = [[DisplayMap alloc] init];
ann1.title = @"Walnut Ridge Fire Department";
ann1.subtitle = @"3217 Highway 67 # B, Walnut Ridge, AR";
ann1.coordinate = region1.center;
[mapView addAnnotation:ann1];
對於UITableView的分組,在哪裏以及如何將我使用的代碼,如果我的代碼看起來像這樣:
- (void)viewDidLoad {
[super viewDidLoad];
//Initialize the array.
listOfItems = [[NSMutableArray alloc] init];
NSArray *sectionOneArray = [NSArray arrayWithObjects:@"Mission Statement", @"Become a Member", @"Bible Ministries", @"FCFi on Facebook", @"Chapter Kit (PDF)", @"Corporate Members", @"FDIC Indianapolis", @"9/11/2001", nil];
NSArray *sectionTwoArray = [NSArray arrayWithObjects:@"About", @"Developer", nil];
NSArray *websiteArray = [NSArray arrayWithObjects:@"FCFi Website", nil];
[listOfItems addObject:sectionOneArray];
[listOfItems addObject:sectionTwoArray];
[listOfItems addObject:websiteArray];
//Set the title
self.navigationItem.title = @"More";
}
搜索annotation-
它通過你想如何燒焦的註解,如果你想按標題搜索它,然後首先使用的MKMapView
註解財產得到所有註釋取決於 -
NSArray *arr = [mapView annotations];
for(int i=0; i<[arr count]; i++)
{
MKAnnotation *ann = [arr objectAtIndex:i];
if([ann.title isEqualToString:[searchBar text]])
{
//do what you want to do after getting a annotation
}
}
的UITableView -
如果你想在小區自來水鏈接,那麼你可以做到這一點在
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
對於組表首先檢查indexPath.section,然後檢查indexPath.row。
你是什麼意思「搜索註釋」?你的問題不清楚... – GendoIkari 2011-03-31 16:28:23