2011-03-31 59 views

回答

1

對於地圖,我會在哪裏放置搜索代碼,以及如果這是我的註釋。

- (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"; 
} 
0

搜索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。

相關問題