I am trying to implement the feature template picker found here. I have added the layer I need to the feature template picker controller, but for some reason UITableView is not populating the templates. I have not made any changes to the GitHub sample for the FeatureLayerTemplatePickerController.swift file. Here is where I'm adding the templates:
// MARK: set feature layer template picker to sightings
func webMap(webMap: AGSWebMap!, didLoadLayer layer: AGSLayer!) {
if let featureLayer = layer as? AGSFeatureLayer {
if (featureLayer.name == "EAB Sighting"){
self.sightings = featureLayer
self.sightings.editingDelegate = self
//Add templates from this layer to the Feature Template Picker
self.featureTemplatePickerController.addTemplatesFromLayer(self.sightings)
for template in self.featureTemplatePickerController.infos {
print(template.featureTemplate.name)
}
}
}
}
It seems like the templates are being added to the template picker correctly because my print statement shows the template names:
This matches the legend of the Webmap I'm using (left image below). I cannot figure out what is going on. When I present the template picker view controller it is a blank table. I have added an outlet to the UITable as well (right image below):
Has anyone else ran into this issue? I cannot figure out what I'm doing wrong.
Solved! Go to Solution.
Can you check what is the state at this line and this? Are the 5 templates getting appended fine?
You mentioned you have added an outlet to the table. How about the datasource and delegate? Are these methods getting called successfully?
Can you check what is the state at this line and this? Are the 5 templates getting appended fine?
You mentioned you have added an outlet to the table. How about the datasource and delegate? Are these methods getting called successfully?
Ah, thank you! I had set the referencing outlet but forgot to set the outlets for the dataSource and delegate, no wonder it didn't work! Once I did that my templates showed up! In case anyone else forgets this crucial step, here it is: