Cannot get FeatureTemplatePicker to work

2793
2
Jump to solution
03-24-2016 09:57 PM
by Anonymous User
Not applicable

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:

template_printout.png

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):

legend.pngoutlet_ref.png

initial_view.pngempty_template.png

Has anyone else ran into this issue?  I cannot figure out what I'm doing wrong.

0 Kudos
1 Solution

Accepted Solutions
SuganyaBaskaran1
Esri Contributor

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?

View solution in original post

2 Replies
SuganyaBaskaran1
Esri Contributor

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?

by Anonymous User
Not applicable

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:

Screen Shot 2016-04-11 at 8.49.43 PM.png

0 Kudos