Select to view content in your preferred language

AGSPopupsContainerViewController

3282
4
09-09-2011 05:50 PM
hermancheah
Emerging Contributor
Hi there
from FeatureLayerEditingSample. there is a part of code in FeatureLayerEditingSampleViewController.m
stating of initializing the popup view controller from a webmap
as below
//Iniitalize a popup view controller
self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithWebMap:self.webmap forFeature:_newFeature usingNavigationControllerStack:NO] autorelease];

what do i do if i am to load this from a offline layer cache ?

i was able to modify the code so it actually uses the offlineonline method as below

        // Add feature layer
   
    self.OnOffLineLayer = [AGSFeatureLayer featureServiceLayerWithURL:[NSURL URLWithString:FEATURE_SERVICE_URL] mode:AGSFeatureLayerModeOnDemand];
    self.OnOffLineLayer = [OnlineOfflineFeatureLayer featureServiceLayerWithURL:[NSURL URLWithString:FEATURE_SERVICE_URL] mode:AGSFeatureLayerModeOnDemand];
    self.OnOffLineLayer.infoTemplateDelegate = self;
    self.OnOffLineLayer.outFields = [NSArray arrayWithObject:@"*"];
   

now if i could load the feature from the self.OnOfflineLayer it be great. but it just kick me off.

self.popupVC = [[[AGSPopupsContainerViewController alloc]  initWithWebMap:self.OnOffLineLayer forFeature:_newFeature  usingNavigationControllerStack:NO] autorelease];
0 Kudos
4 Replies
NimeshJarecha
Esri Regular Contributor
You should use other init methods of AGSPopupsContainerViewController. Also, you'll have to create AGSPopupInfo and AGSPopup objects.

Regards,
Nimesh
0 Kudos
hermancheah
Emerging Contributor
Thanks for reply
any sample  to create AGSPopupInfo and AGSPopup objects ? please
0 Kudos
EddieJesinsky
Deactivated User
AGSPopupInfo *popupInfo = [AGSPopupInfo popupInfoForGraphic:_newFeature];
AGSPopupsContainerViewController *popup = [[AGSPopupsContainerViewController alloc] initWithPopupInfo:popupInfo graphic:_newFeature usingNavigationControllerStack:NO];


It would be nice if the AGSPopupsContainerViewController code was opened up as a sample. I've had problems using it offline, so I pretty much had to reimplement the entire thing from scratch (if there was a way to avoid it I'd certainly like to know). I still haven't implemented the attachments viewer/editor, but it would be nice if I had the controller code to work from.

For example, when using the controller on an offline (cached with the init from JSON) feature layer, the controller does not respond when clicking the 'Done' button after editing an attribute.
0 Kudos
hermancheah
Emerging Contributor
Thanks for you word, being of what you said i think this will be a little complicated to do offline editing via popups.

i have tried to put this together.
      //featureLayer is the offline cache layer

      self.activeFeatureLayer = featureLayer;
   
    _newFeature = [self.activeFeatureLayer createFeatureWithTemplate:template];
   
    [self.activeFeatureLayer addGraphic:_newFeature];
   
    AGSPopupInfo *popupInfo = [AGSPopupInfo popupInfoForGraphic:_newFeature];
   
    popupInfo.title = @"Details";
   
    popupInfo.allowEditGeometry = YES;
   
   
    AGSPopupsContainerViewController *popup = [[AGSPopupsContainerViewController alloc] initWithPopupInfo:popupInfo graphic:_newFeature usingNavigationControllerStack:NO];
    self.popupVC = popup;
   
    self.popupVC.delegate = self;
   
        //First, dismiss the Feature Template Picker
    [self dismissModalViewControllerAnimated:YES];
   
        //Next, Present the popup view controller //ERROR HERE
    [self presentModalViewController:self.popupVC animated:YES];
    [self.popupVC startEditingCurrentPopup];


no hope . it failed me
0 Kudos