Hi,
At : Edit features—ArcGIS Runtime SDK for iOS | ArcGIS for Developers
Trying to use it with your : arcgis-runtime-samples-ios/OfflineFeatureEditingSample at master · Esri/arcgis-runtime-samples-ios ·...
But its not working, Can any of the admin try and let me know if its work and how they achieved.
Best Regards
Can't remember how many time i have asked this specific question, And still no one has answered or replied. Even opened an issue on Github but still no answer.
Github Issue : Cannot select features on AGSFeatureTableLayer · Issue #184 · Esri/arcgis-runtime-samples-ios · GitH...
Can someone please share a working sample.
Regards
Hi Ozcan,
For the question about how to use this method "isFeatureSelected" for AGSFeatureTableLayer, here are several things you need to take a look in order to make it work.
1. This selectioncolor property is only available in AGSFeatureTableLayer and AGSGraphicsLayer, therefore, you want to make sure the feature that you click is coming from either AGSFeatureTableLayer or AGSGraphicsLayer.
2. If you want to make it works in offline mode, then you should use AGSFeatureTableLayer; If you want to use in online mode you should use AGSGraphicsLayer, or follow this sample code from Runtime Quartz Feature layer selection, however, this sample is using another method called "selectFeaturesWithQuery:selectionMethod" from AGSFeatureLayer. Rather than the one you see from our developer page for setSelected method Edit features—ArcGIS Runtime SDK for iOS | ArcGIS for Developers
3. Here I assume you want to use the AGSFeatureTableLayer to highlight the clicked features, here are some codes to show you how to make it work.
//instantiate variables in order to convert AGSfeatureLayer to AGSGDBFeatureServiceTable, and then use AGSGDBFeatureServiceTable to AGSFeatureTableLayer var featureServiceTable: AGSGDBFeatureServiceTable! var ftLayer: AGSFeatureTableLayer! //init AGSGDBFeatureServiceTable based let url = NSURL(string: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/MapServer/0") //init AGSGDBFeatureServiceTable based on ArcGIS Featureservice/Mapservice URL featureServiceTable = AGSGDBFeatureServiceTable.init(serviceURL: url, credential: nil, spatialReference: AGSSpatialReference.wgs84SpatialReference()) //create an local FeatureTableLayer based on featureServiceTable ftLayer = AGSFeatureTableLayer.init(featureTable: featureServiceTable) //define the selectionColor ftLayer.selectionColor = UIColor.redColor(); //add the AGSFeatureTableLayer to map self.mapView.addMapLayer(ftLayer, withName: "FeatureLayer"); //#pragma mark - AGSMapViewTouchDelegate methods //Use AGSMapViewTouchDelegate to trigger the click event func mapView(mapView: AGSMapView!, didClickAtPoint screen: CGPoint, mapPoint mappoint: AGSPoint!, features: [NSObject : AnyObject]!) { ftLayer.clearSelection() if features != nil { //Need to define feature comes from which layer, by using featureservice's layer name let array = features["Wildfire Response Points"] as! [AGSFeature] for feature in array { ftLayer.setSelected(true, forFeature: feature) print("Is the feature selected?, Answer: \(ftLayer.isFeatureSelected(feature))") } } else { print("No feature selected around your click.") } }
Hope this helps!
ozcan durak In case you still not make it works. Here I shared with you a github sample that I created a sample: