【发布时间】:2012-08-03 04:12:45
【问题描述】:
目标 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 方法。
提前致谢。
【问题讨论】:
-
确保将 mapview 连接到插座,并在您的情况下将其作为文件所有者的 delegate = self
-
是的,出口 mapView 已经连接到文件所有者。我的每个插座都连接到它们的适当位置
-
并且mapview的代理也被分配给文件所有者仔细检查这一步
-
地图视图的代理不在插座中
标签: iphone objective-c ios xcode4.3 arcgis