iOS:Arcgis:featureLayer.types 返回 Null
我正在尝试在图层内添加要素类型(featureLayer.types),以便用户可以选择一个。 ESRI 的示例“FeatureLayerEditingSample”执行此操作,但视图控制器是通过之前的视图控制器初始化的。 http://www.arcgis.com/home/item.html?id=2ddb261648074b9aabb22240b6975918
当我尝试时循环遍历我的 featureLayer 的类型,它不会返回任何内容并且 [self.featureLayer.types count] 返回 0。
我想我缺少一些需要设置为 featureLayer 的基本属性。感谢这方面的任何帮助。
我的 viewDidLoad 方法是这样的:
self.featureLayer = [AGSFeatureLayer featureServiceLayerWithURL:[NSURL URLWithString:@"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"] mode:AGSFeatureLayerModeOnDemand];
NSArray* types1 = self.featureLayer2.types;
AGSFeatureType* selectedType1 = [types1 objectAtIndex:2];
NSLog(@"count of types is %d \n", [selectedType1.types count]); //returns 0
非常感谢!
I am trying to feature types (featureLayer.types) within a layer so that the user can select one.
ESRI's Sample "FeatureLayerEditingSample" does this but the view controller is initialized through the previous View Controller there. http://www.arcgis.com/home/item.html?id=2ddb261648074b9aabb22240b6975918
When I try to loop through the types of my featureLayer, it doesn't return anything and
[self.featureLayer.types count] returns 0.
I think I'm missing some basic properties that need to set to the featureLayer. Appreciate any help in this.
My viewDidLoad method goes like this:
self.featureLayer = [AGSFeatureLayer featureServiceLayerWithURL:[NSURL URLWithString:@"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"] mode:AGSFeatureLayerModeOnDemand];
NSArray* types1 = self.featureLayer2.types;
AGSFeatureType* selectedType1 = [types1 objectAtIndex:2];
NSLog(@"count of types is %d \n", [selectedType1.types count]); //returns 0
Thanks a ton!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要先将该功能添加到mapView中。在添加之前,它不会从 MapService 检索信息。您应该指定一个 Layer Delegate,以便您可以侦听 Layer 是否成功加载。
You need to add the feature to the mapView first. It won't retrieve the information from the MapService until it's been added. You should specify a Layer Delegate so that you can listen for the Layer to be loaded sucessfully.