1

Objective C は初めてで、マップ部分に ArcGIS を使用しています。mapViewDidLoadメソッドが呼び出されない/ロードされないという問題があります。コードの一部を次に示します。

.h ファイル

@interface ViewController : UIViewController<AGSMapViewLayerDelegate, AGSMapViewTouchDelegate, AGSMapViewCalloutDelegate>{
AGSMapView *_mapView;
AppDelegate *appDelegate;
...
}

.m ファイル

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.activityView startAnimating];
    self.mapView.touchDelegate = self;
    self.mapView.calloutDelegate = self;
    appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    CLLocationManager *locationManager = [[CLLocationManager alloc] init];
    ...
}

- (void)mapViewDidLoad:(AGSMapView *)mapView {

    AGSEnvelope *envelope = [[AGSEnvelope alloc]initWithXmin:29757.610204117
                                                    ymin:40055.0379682464
                                                    xmax:29884.6992302249
                                                    ymax:40236.6028660071
                                        spatialReference:self.mapView.spatialReference];
    [self.mapView zoomToEnvelope:envelope animated:YES];

    self.mapView.callout.width = 195.0f;
    self.mapView.callout.accessoryButtonHidden = YES;

    [self.mapView.gps start];
    [self.mapView centerAtPoint:self.mapView.gps.currentPoint animated:YES];   
    NSLog(@"Location : %@", self.mapView.gps.currentPoint);

    [self.activityView stopAnimating];
    self.activityView.hidden = YES;

}

mapViewDidLoadメソッドをロードしないのはなぜですか。前もって感謝します。

4

2 に答える 2

0

追加self.mapView.delegate = self;するだけviewDidLoad

于 2012-08-06T07:37:10.850 に答える
0

mapview を右クリックして mapviewdelegate が接続されていることを確認し、delegate を割り当てます。 ここに画像の説明を入力

または追加[self.mapview setDelegate:self];

あなたの場合、 "AGSMapView" mapViewDidLoad: AGSMapViewLayerDelegate のメソッドは、最初のレイヤーがマップに追加された後に呼び出されます。この時点で、コンポーネントは完全に機能します。http://help.arcgis.com/en/arcgismobile/10.0/apis/iphone/reference/interface_a_g_s_map_view.htmlで参照できます。

make self.mapview.layerDelegate = self;

于 2012-08-06T07:38:51.363 に答える