Legend code with XCode 4.2 and storyboard

735
2
Jump to solution
01-13-2012 09:03 AM
RickJones
Occasional Contributor II
Has anyone tried the legend code with a storyboard?

I have a modified legend working with a .xib style project. It uses on/off slider switch on each layer, with collapsing sub-types. All icons render.

I just made a storyboard sample, with a button calling a segue for a popover tableview controller.

The Dynamic layers display legend icons properly.
The Feature layers display legend icons only for the lines in the visible frame of the popover.
Anything else has no legend icons when scrolled into view.

Also, if the layer is turned off (layer view's alpha = 0) when the legend appears, the icons never appear even for the parts within the frame.

I can provide code.
0 Kudos
1 Solution

Accepted Solutions
RickJones
Occasional Contributor II
It turns out I had a weak reference to the icon image.
Changed that to strong, and everything is ok, icons render properly.

I'd like to submit my legend for review. Perhaps someone would find it useful.

View solution in original post

0 Kudos
2 Replies
RickJones
Occasional Contributor II
It turns out I had a weak reference to the icon image.
Changed that to strong, and everything is ok, icons render properly.

I'd like to submit my legend for review. Perhaps someone would find it useful.
0 Kudos
RickJones
Occasional Contributor II
Here is my project using an ESRI basemap and the trail feature layer.
It is very basic, the legend button only displays the legend. Touch the map to release it.

The segue is created by right-clicking-and-dragging from the Legend button to the TOC view.
When the button is touched, it fires the segue (after calling prepareForSegue).

The legend uses an array for the layers, and another array for visible index of layers (from collapsing breakdown lines).
Each layer has a pointer to it's view, for setting the alpha on or off.

The legend array is only loaded when the TOC screen is displayed because OnlineOfflineFeatureLayers were not triggering LayerLoaded in offline mode.

Reusable tableview cells were causing problems redrawing with other cells' switches, so I use unique cell names.

**Only the iPad storyboard has been setup**
0 Kudos