Adding Popup Title and particular feature layer information

1009
8
Jump to solution
06-27-2012 10:13 AM
JohnMcleod1
New Contributor III
Hello Everyone,
I'm continuing from a former post.

http://forums.arcgis.com/threads/61025-iOS-Popup-not-displaying-feature-layer-information

Now, I want to have only some of the information show up in pop up. 
Below is my code from the "didClickCalloutAccessoryButtonForGraphic" method

-(void)mapView:(AGSMapView *)mapView didClickCalloutAccessoryButtonForGraphic:(AGSGraphic *)graphic{          self.activeFeatureLayer = (AGSFeatureLayer*) graphic.layer;          AGSPopupInfo *info = [AGSPopupInfo popupInfoForGraphic:graphic];     //Show popup for the graphic because the user tapped on the callout accessory button          self.popupVC.title = @"Parcel Information";     //ADDED THIS LINE FROM THE "Related Record Editing Sample"     self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithPopupInfo:info graphic:graphic usingNavigationControllerStack:NO] autorelease];          //COMMENTED MY CODE     //self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithWebMap:self.webmap forFeature:graphic usingNavigationControllerStack:NO] autorelease];          self.popupVC.delegate = self;     self.popupVC.modalTransitionStyle =  UIModalTransitionStyleFlipHorizontal;               //If iPad, use a modal presentation style     if([[UIDevice currentDevice] isIPad])         self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;     [self presentModalViewController:self.popupVC animated:YES];      }


Also, I tried to set a title to the pop up and it doesn't work.

John
0 Kudos
1 Solution

Accepted Solutions
JohnMcleod1
New Contributor III
Thanks for the reply and the answer on the popup title.

How would you display particular field information?
The layer has several fields and I only wish to display a few.

John

View solution in original post

0 Kudos
8 Replies
NimeshJarecha
Esri Regular Contributor
You should change
self.popupVC.title = @"Parcel Information";

to
info.title = @"Parcel Information";

Regards,
Nimesh
0 Kudos
JohnMcleod1
New Contributor III
Thanks for the reply and the answer on the popup title.

How would you display particular field information?
The layer has several fields and I only wish to display a few.

John
0 Kudos
NimeshJarecha
Esri Regular Contributor
You can either remove unwanted fields from info.fieldInfos or set outFields property of feature layer.

However, I just want to let you know that based on your code you are not using the popups defined in the web map. So if you make any changes in the popup defined on a web map then you won't see those changes.

If you are using the popup defined in the web map then you can manage the fields in the web map and it'll be honored in your app.

Regards,
Nimesh
0 Kudos
JohnMcleod1
New Contributor III
When I used the following code

self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithWebMap:self.webmap forFeature:graphic usingNavigationControllerStack:NO] autorelease];


and enable popups for the layer in my webmap, the field data does not show up.

[ATTACH=CONFIG]15570[/ATTACH]

John
0 Kudos
NimeshJarecha
Esri Regular Contributor
The field data does not show up because graphic belongs to "Koch Boundary" layer and it does not have popups enabled. Just change your code of didClickCalloutAccessoryButtonForGraphic like this...it won't show popup for the boundary layer.

-(void)mapView:(AGSMapView *)mapView didClickCalloutAccessoryButtonForGraphic:(AGSGraphic *)graphic{
   
    self.activeFeatureLayer = (AGSFeatureLayer*) graphic.layer;
    NSLog(@"%@",graphic.layer.name);
    if (![graphic.layer.name isEqualToString:@"Koch_Boundary1"]) {
        //Show popup for the graphic because the user tapped on the callout accessory button
        self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithWebMap:self.webmap forFeature:graphic usingNavigationControllerStack:NO] autorelease];
        self.popupVC.delegate = self;
        self.popupVC.modalTransitionStyle =  UIModalTransitionStyleFlipHorizontal;
        //If iPad, use a modal presentation style
        if([[UIDevice currentDevice] isIPad])
            self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;
        [self presentModalViewController:self.popupVC animated:YES];
    }
}

Hope this helps!

Regards,
Nimesh
0 Kudos
JohnMcleod1
New Contributor III
Unfortunately, when I use your code, I get nothing in the popup box.

John
0 Kudos
NimeshJarecha
Esri Regular Contributor
Try attached feature layer editing sample which uses your web map.

Regards,
Nimesh
0 Kudos
JohnMcleod1
New Contributor III
Well, that did it!
It works flawlessly.
I customize my popup attributes list and it works.

Now the task, integrating the sample into my work.
What, in your experience, would be the quickest and easily?

John
0 Kudos