1

57個の注釈があり、これらの注釈をテーブルビューに配置しようとしています。また、セルをクリックして、対応する注釈にズームインできるようにしたいです。注釈とテーブルビューをどのように接続するのか疑問に思いました。

注釈の私のコード:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self configureView];
    CLLocationCoordinate2D thecoordinate1;
    thecoordinate1.latitude = 51.2205806;
    thecoordinate1.longitude = 4.3997224;

    CLLocationCoordinate2D thecoordinate2;
    thecoordinate2.latitude = 33.7489;
    thecoordinate2.longitude = -84.3881;


    CLLocationCoordinate2D thecoordinate3;
    thecoordinate3.latitude = -36.8500;
    thecoordinate3.longitude = 174.78;

    CLLocationCoordinate2D thecoordinate4;
    thecoordinate4.latitude = 41.38333;
    thecoordinate4.longitude = 2.18333;

    CLLocationCoordinate2D thecoordinate5;
    thecoordinate5.latitude = 52.58;
    thecoordinate5.longitude = 13.416;

    CLLocationCoordinate2D thecoordinate6;
    thecoordinate6.latitude = 52.4667;
    thecoordinate6.longitude = -1.9;

    CLLocationCoordinate2D thecoordinate7;
    thecoordinate7.latitude = 42.3583;
    thecoordinate7.longitude = -71.9693;

    CLLocationCoordinate2D thecoordinate8;
    thecoordinate8.latitude = -27.467;
    thecoordinate8.longitude = 153.03;

    CLLocationCoordinate2D thecoordinate9;
    thecoordinate9.latitude = 50.83;
    thecoordinate9.longitude = 4.33;

    CLLocationCoordinate2D thecoordinate10;
    thecoordinate10.latitude = 51.0544;
    thecoordinate10.longitude = -114.0687;

    CLLocationCoordinate2D thecoordinte11;
    thecoordinte11.latitude = -33.906896;
    thecoordinte11.longitude = 18.3667;

    CLLocationCoordinate2D thecoordinate12;
    thecoordinate12.latitude = 41.8500;
    thecoordinate12.longitude = -87.6500;

    CLLocationCoordinate2D thecoordinate13;
    thecoordinate13.latitude = 55.75;
    thecoordinate13.longitude = 12.4167;

    CLLocationCoordinate2D thecoordinate14;
    thecoordinate14.latitude = 32.7828;
    thecoordinate14.longitude = -96.8039;

    CLLocationCoordinate2D thecoordinate15;
    thecoordinate15.latitude = 39.7392;
    thecoordinate15.longitude = -104.9842;

    CLLocationCoordinate2D thecoordinate16;
    thecoordinate16.latitude = 53.33;
    thecoordinate16.longitude = -6.25;

    CLLocationCoordinate2D thecoordinate17;
    thecoordinate17.latitude = 51.226;
    thecoordinate17.longitude = 6.7828;

    CLLocationCoordinate2D thecoordinate18;
    thecoordinate18.latitude = 55.950;
    thecoordinate18.longitude = -3.2200;

    CLLocationCoordinate2D thecoordinate19;
    thecoordinate19.latitude = 50.1167;
    thecoordinate19.longitude = 8.6833;

    CLLocationCoordinate2D thecoordinate20;
    thecoordinate20.latitude = 46.2000;
    thecoordinate20.longitude = 6.15000;

    CLLocationCoordinate2D thecoordinate21;
    thecoordinate21.latitude = 53.55;
    thecoordinate21.longitude = 9.983;

    CLLocationCoordinate2D thecoordinate22;
    thecoordinate22.latitude = 29.7631;
    thecoordinate22.longitude = -95.3663;

    CLLocationCoordinate2D thecoordinate23;
    thecoordinate23.latitude = -26.13;
    thecoordinate23.longitude = 28.445;

    CLLocationCoordinate2D thecoordinate24;
    thecoordinate24.latitude = 38.73;
    thecoordinate24.longitude = -9.133;

    CLLocationCoordinate2D thecoordinate25;
    thecoordinate25.latitude = 51.5081289;
    thecoordinate25.longitude = -0.128005;

    CLLocationCoordinate2D thecoordinate26;
    thecoordinate26.latitude = 34.05;
    thecoordinate26.longitude = -118.25;

    CLLocationCoordinate2D thecoordinate27;
    thecoordinate27.latitude = 40.4;
    thecoordinate27.longitude = -3.6833;

    CLLocationCoordinate2D thecoordinate28;
    thecoordinate28.latitude = 53.4800;
    thecoordinate28.longitude = -2.2400;

    CLLocationCoordinate2D thecoordinate29;
    thecoordinate29.latitude = -37.7833;
    thecoordinate29.longitude = 144.9667;

    CLLocationCoordinate2D thecoordinate30;
    thecoordinate30.latitude = 25.47;
    thecoordinate30.longitude = -80.13;

    CLLocationCoordinate2D thecoordinate31;
    thecoordinate31.latitude = 45.4640;
    thecoordinate31.longitude = 9.1916;

    CLLocationCoordinate2D thecoordinate32;
    thecoordinate32.latitude = 44.9800;
    thecoordinate32.longitude = -93.2636;

    CLLocationCoordinate2D thecoordinate33;
    thecoordinate33.latitude = 45.5681;
    thecoordinate33.longitude = -73.5500;

    CLLocationCoordinate2D thecoordinate34;
    thecoordinate34.latitude = 48.133;
    thecoordinate34.longitude = 11.5667;

    CLLocationCoordinate2D thecoordinate35;
    thecoordinate35.latitude = 40.7167;
    thecoordinate35.longitude = -74;

    CLLocationCoordinate2D thecoordinate36;
    thecoordinate36.latitude = 59.9494;
    thecoordinate36.longitude = 10.7564;

    CLLocationCoordinate2D thecoordinate37;
    thecoordinate37.latitude = 48.8742; 
    thecoordinate37.longitude = 2.3470;

    CLLocationCoordinate2D thecoordinate38;
    thecoordinate38.latitude = -31.933;
    thecoordinate38.longitude = 115.83;

    CLLocationCoordinate2D thecoordinate39;
    thecoordinate39.latitude = 39.9522;
    thecoordinate39.longitude = -75.1642;

    CLLocationCoordinate2D thecoordinate40;
    thecoordinate40.latitude = 45.5236;
    thecoordinate40.longitude = -112.6750;

    CLLocationCoordinate2D thecoordinate41;
    thecoordinate41.latitude = 41.1667;
    thecoordinate41.longitude = 8.5833;

    CLLocationCoordinate2D thecoordinate42;
    thecoordinate42.latitude = 50.0833;
    thecoordinate42.longitude = 14.41667;

    CLLocationCoordinate2D thecoordinate43;
    thecoordinate43.latitude = 41.8;
    thecoordinate43.longitude = 12.6;

    CLLocationCoordinate2D thecoordinate44;
    thecoordinate44.latitude = 51.9217;
    thecoordinate44.longitude = 4.4811;

    CLLocationCoordinate2D thecoordinate45;
    thecoordinate45.latitude = 32.7153;
    thecoordinate45.longitude = -117.1564;

    CLLocationCoordinate2D thecoordinate46;
    thecoordinate46.latitude = 37.7750;
    thecoordinate46.longitude = -122.4183;

    CLLocationCoordinate2D thecoordinate47;
    thecoordinate47.latitude = 47.6097;
    thecoordinate47.longitude = -122.3331;

    CLLocationCoordinate2D thecoordinate48;
    thecoordinate48.latitude = 37.566535;
    thecoordinate48.longitude =126.9779692;

    CLLocationCoordinate2D thecoordinate49;
    thecoordinate49.latitude = 59.33;
    thecoordinate49.longitude = 18.05;

    CLLocationCoordinate2D thecoordinate50;
    thecoordinate50.latitude = -33.873651;
    thecoordinate50.longitude = 151.2068896;

    CLLocationCoordinate2D thecoordinate51;
    thecoordinate51.latitude = 35.6894515;
    thecoordinate51.longitude = 139.6917064;

    CLLocationCoordinate2D thecoordinate52;
    thecoordinate52.latitude = 43.65;
    thecoordinate52.longitude = -79.38333;

    CLLocationCoordinate2D thecoordinate53;
    thecoordinate53.latitude = 49.267;
    thecoordinate53.longitude = -123.11667;

    CLLocationCoordinate2D thecoordinate54;
    thecoordinate54.latitude = 48.2092062;
    thecoordinate54.longitude = 16.3727778;

    CLLocationCoordinate2D thecoordinate55;
    thecoordinate55.latitude = 52.2296756;
    thecoordinate55.longitude = 21.0122287;

    CLLocationCoordinate2D thecoordinate56;
    thecoordinate56.latitude = 38.90813;
    thecoordinate56.longitude = -77.01416;

    CLLocationCoordinate2D thecoordinate57;
    thecoordinate57.latitude = -41.28648;
    thecoordinate57.longitude = 174.776217;

    CLLocationCoordinate2D thecoordinate58;
    thecoordinate58.latitude = 47.3686498;
    thecoordinate58.longitude = 8.5391825;

    CLLocationCoordinate2D thecoordinate59;
    thecoordinate59.latitude = 51.520504;
    thecoordinate59.longitude = -0.106725; 
    Location *ann1 = [[Location alloc] init];
    ann1.title =@"Antwerp";
    ann1.coordinate = thecoordinate1;

    Location *ann2 = [[Location alloc] init];
    ann2.title =@"Atlanta";
    ann2.coordinate = thecoordinate2;

    Location *ann3 = [[Location alloc] init];
    ann3.title = @"Auckland";
    ann3.coordinate = thecoordinate3;

    Location *ann4 = [[Location alloc] init];
    ann4.title = @"Barcelona";
    ann4.coordinate = thecoordinate4;

    Location *ann5 = [[Location alloc] init];
    ann5.title = @"Berlin";
    ann5.coordinate = thecoordinate5;

    Location *ann6 = [[Location alloc] init];
    ann6.title = @"Birmingham";
    ann6.coordinate = thecoordinate6;

    Location *ann7 = [[Location alloc] init];
    ann7.title = @"Boston";
    ann7.coordinate =thecoordinate7;

    Location *ann8 = [[Location alloc] init];
    ann8.title = @"Brisbane";
    ann8.coordinate = thecoordinate8;

    Location *ann9 = [[Location alloc] init];
    ann9.title = @"Brussels";
    ann9.coordinate = thecoordinate9;

    Location *ann10 = [[Location alloc] init];
    ann10.title = @"Calgary";
    ann10.coordinate = thecoordinate10;

    Location *ann11 = [[Location alloc] init];
    ann11.title = @"Cape Town";
    ann11.coordinate = thecoordinte11;

    Location *ann12 = [[Location alloc] init];
    ann12.title = @"Chicago";
    ann12.coordinate = thecoordinate12;

    Location *ann13 = [[Location alloc] init];
    ann13.title = @"Copenhagen";
    ann13.coordinate = thecoordinate13;

    Location *ann14 = [[Location alloc] init];
    ann14.title = @"Dallas";
    ann14.coordinate = thecoordinate14;

    Location *ann15 = [[Location alloc] init];
    ann15.title = @"Denver" ;
    ann15.coordinate = thecoordinate15;

    Location *ann16 = [[Location alloc] init];
    ann16.title = @"Dublin";
    ann16.coordinate = thecoordinate16;

    Location *ann17 = [[Location alloc] init];
    ann17.title = @"Dusseldorf";
    ann17.coordinate = thecoordinate17;

    Location *ann18 = [[Location alloc] init];
    ann18.title = @"Edinburgh";
    ann18.coordinate = thecoordinate18;

    Location *ann19 = [[Location alloc] init];
    ann19.title = @"Frankfurt";
    ann19.coordinate = thecoordinate19;

    Location *ann20 = [[Location alloc] init];
    ann20.title = @"Geneva";
    ann20.coordinate = thecoordinate20;

    Location *ann21 = [[Location alloc] init];
    ann21.title = @"Hamburg";
    ann21.coordinate = thecoordinate21;

    Location *ann22 = [[Location alloc] init];
    ann22.title = @"Houston";
    ann22.coordinate = thecoordinate22;

    Location *ann23 = [[Location alloc] init];
    ann23.title = @"JohannesBurg";
    ann23.coordinate = thecoordinate23;

    Location *ann24 = [[Location alloc] init];
    ann24.title = @"Lisbon";
    ann24.coordinate = thecoordinate24;

    Location *ann25 = [[Location alloc] init];
    ann25.title = @"London";
    ann25.coordinate = thecoordinate25;

    Location *ann26 = [[Location alloc] init];
    ann26.title = @"Los Angeles";
    ann26.coordinate = thecoordinate26;

    Location *ann27 = [[Location alloc] init];
    ann27.title = @"Madrid";
    ann27.coordinate = thecoordinate27;

    Location *ann28 = [[Location alloc] init];
    ann28.title =@"Manchester" ;
    ann28.coordinate = thecoordinate28;

    Location *ann29 = [[Location alloc] init];
    ann29.title = @"Melbourne";
    ann29.coordinate = thecoordinate29;

    Location *ann30 = [[Location alloc] init];
    ann30.title = @"Miami";
    ann30.coordinate = thecoordinate30;

    Location *ann31 = [[Location alloc] init];
    ann31.title = @"Milan";
    ann31.coordinate = thecoordinate31;

    Location *ann32 = [[Location alloc] init];
    ann32.title = @"Minneapolis";
    ann32.coordinate = thecoordinate32;

    Location *ann33 = [[Location alloc] init];
    ann33.title = @"Montreal";
    ann33.coordinate = thecoordinate33;

    Location *ann34 = [[Location alloc] init];
    ann34.title = @"Munich";
    ann34.coordinate = thecoordinate34;

    Location *ann35 = [[Location alloc] init];
    ann35.title = @"New York";
    ann35.coordinate = thecoordinate35;

    Location *ann36 = [[Location alloc] init];
    ann36.title = @"Oslo";
    ann36.coordinate = thecoordinate36;

    Location *ann37 = [[Location alloc] init];
    ann37.title = @"Paris";
    ann37.coordinate = thecoordinate37;

    Location *ann38 = [[Location alloc] init];
    ann38.title = @"Perth";
    ann38.coordinate = thecoordinate38;

    Location *ann39 = [[Location alloc] init];
    ann39.title = @"Philadeplphia";
    ann39.coordinate = thecoordinate39;

    Location *ann40 = [[Location alloc] init];
    ann40.title = @"Portland";
    ann40.coordinate = thecoordinate40;

    Location *ann41 = [[Location alloc] init];
    ann41.title = @"Porto";
    ann41.coordinate = thecoordinate41;

    Location *ann42 = [[Location alloc] init];
    ann42.title = @"Prague";
    ann42.coordinate = thecoordinate42;

    Location *ann43 = [[Location alloc] init];
    ann43.title = @"Rome";
    ann43.coordinate = thecoordinate43;

    Location *ann44 = [[Location alloc] init];
    ann44.title = @"Rotterdam";
    ann44.coordinate = thecoordinate44;

    Location *ann45 = [[Location alloc] init];
    ann45.title = @"San Diego";
    ann45.coordinate = thecoordinate45;

    Location *ann46 = [[Location alloc] init];
    ann46.title = @"San Fransisco";
    ann46.coordinate = thecoordinate46;

    Location *ann47 = [[Location alloc] init];
    ann47.title = @"Seattle";
    ann47.coordinate = thecoordinate47;

    Location *ann48 = [[Location alloc] init];
    ann48.title = @"Seoul";
    ann48.coordinate = thecoordinate48;

    Location *ann49 = [[Location alloc] init];
    ann49.title =   @"Stockholm";
    ann49.coordinate = thecoordinate49;

    Location *ann50 = [[Location alloc] init];
    ann50.title = @"Sydney";
    ann50.coordinate = thecoordinate50;

    Location *ann51 = [[Location alloc] init];
    ann51.title = @"Tokyo";
    ann51.coordinate = thecoordinate51;

    Location *ann52 = [[Location alloc] init];
    ann52.title = @"Toronto";
    ann52.coordinate = thecoordinate52;

    Location *ann53 = [[Location alloc] init];
    ann53.title = @"Vancouver";
    ann53.coordinate = thecoordinate53;

    Location *ann54 = [[Location alloc] init];
    ann54.title = @"Vienna";
    ann54.coordinate = thecoordinate54;

    Location *ann55 = [[Location alloc] init];
    ann55.title = @"Warsaw";
    ann55.coordinate = thecoordinate55;

    Location *ann56 = [[Location alloc] init];
    ann56.title = @"Washington D.C";
    ann56.coordinate = thecoordinate56;

    Location *ann57 = [[Location alloc] init];
    ann57.title = @"Wellington";
    ann57.coordinate = thecoordinate57;

    Location *ann58 = [[Location alloc] init];
    ann58.title = @"Zurich";        
    ann58.coordinate = thecoordinate58;

    Location *ann59 = [[Location alloc] init];
    ann59.title = @"IPD Headoffice";
    //ann59.subtitle = @"Investment Development Databank";
    ann59.coordinate = thecoordinate59;



    MKCoordinateRegion region = { {0.0, 0.0},{0.0, 0.0} };
    region.center.latitude = 52.35;
    region.center.longitude = 4.9;

    region.span.longitudeDelta = 179.01f;
    region.span.latitudeDelta =179.01f;

    [map setRegion:region animated:YES];

    Location *ann = [[Location alloc] init];
    ann.title = @"Amsterdam";
    // ann.subtitle = @"Investment Property Databank";
    ann.coordinate = region.center;


    [map addAnnotation:ann];
    [map addAnnotation:ann1];
    [map addAnnotation:ann2];
    [map addAnnotation:ann3];
    [map addAnnotation:ann4];
    [map addAnnotation:ann5];
    [map addAnnotation:ann6];
    [map addAnnotation:ann7];
    [map addAnnotation:ann8];
    [map addAnnotation:ann9];
    [map addAnnotation:ann10];
    [map addAnnotation:ann11];
    [map addAnnotation:ann12];
    [map addAnnotation:ann13];
    [map addAnnotation:ann14];
    [map addAnnotation:ann15];
    [map addAnnotation:ann16];
    [map addAnnotation:ann17];
    [map addAnnotation:ann18];
    [map addAnnotation:ann19];
    [map addAnnotation:ann20];
    [map addAnnotation:ann21];
    [map addAnnotation:ann22];
    [map addAnnotation:ann23];
    [map addAnnotation:ann24];
    [map addAnnotation:ann25];
    [map addAnnotation:ann26];
    [map addAnnotation:ann27];
    [map addAnnotation:ann28];
    [map addAnnotation:ann29];
    [map addAnnotation:ann30];
    [map addAnnotation:ann31];
    [map addAnnotation:ann32];
    [map addAnnotation:ann33];
    [map addAnnotation:ann34];
    [map addAnnotation:ann35];
    [map addAnnotation:ann36];
    [map addAnnotation:ann37];
    [map addAnnotation:ann38];
    [map addAnnotation:ann39];
    [map addAnnotation:ann40];
    [map addAnnotation:ann41];
    [map addAnnotation:ann42];
    [map addAnnotation:ann43];
    [map addAnnotation:ann44];
    [map addAnnotation:ann45];
    [map addAnnotation:ann46];
    [map addAnnotation:ann47];
    [map addAnnotation:ann48];
    [map addAnnotation:ann49];
    [map addAnnotation:ann50];
    [map addAnnotation:ann51];
    [map addAnnotation:ann52];
    [map addAnnotation:ann53];
    [map addAnnotation:ann54];
    [map addAnnotation:ann55];
    [map addAnnotation:ann56];
    [map addAnnotation:ann57];
    [map addAnnotation:ann58];
    [map addAnnotation:ann59];

}
4

1 に答える 1

0

名前付き/番号付き変数ではなく、NSArrayに座標をロードします。

注釈をUIMapViewに入力します

UITableViewを使用してNSArrayを表示します

UITableViewのonDidSelect、実行

mapView setCenterCoordinate:(CLLocationCoordinate2D)coordinateアニメーション:(BOOL)NSArrayからのデータでアニメーション化。

于 2012-08-09T05:58:03.267 に答える