【问题标题】:Displaying map with Objective C使用 Objective C 显示地图
【发布时间】:2012-08-23 08:11:32
【问题描述】:

我正在使用此代码来创建此地图:

 AGSTiledMapServiceLayer *tiledLayer =        [AGSTiledMapServiceLayer         
tiledMapServiceLayerWithURL:[NSURL URLWithString:@"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"]];        [self.mapView addMapLayer:tiledLayer withName:@"Tiled Layer"];       
[self addSubView:mapView];

return self;

我正在返回自我并希望像这样显示它:

 Mymap *myMap = [[Mymap alloc] initWithFrame:CGRectMake(20,20, 100, 100)];    
[self.webView addSubView:myMap];

什么都没有发生……有什么想法吗?

【问题讨论】:

  • UIWebview添加子视图很奇怪,你试过[webView.scrollView addSubview:myMap];吗??

标签: objective-c uiview webview maps


【解决方案1】:

使用故事板或 xib。然后,添加 uiview 在其上添加 mapview。现在,通过控件拖动将此 mapOutlet 连接到特定类。而且,就是这样,它会在您的设备上显示地图。

【讨论】:

    猜你喜欢
    • 2014-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多