customViewForGraphic implementation

1222
3
11-28-2011 08:35 PM
MakhdoomZia
New Contributor
Hi,
Does anyone have any (and I mean any) implementation for this method:
- (UIView*) customViewForGraphic:
(AGSGraphic *) graphic
screenPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mapPoint.


I am interested in either or both the programmatical or NIB-file based implementation as a guide. I could not find any example on the entire World Wide Web.
0 Kudos
3 Replies
MakhdoomZia
New Contributor
Hi,
Does anyone have any (and I mean any) implementation for this method:
- (UIView*) customViewForGraphic:
(AGSGraphic *) graphic
screenPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mapPoint.


I am interested in either or both the programmatical or NIB-file based implementation as a guide. I could not find any example on the entire World Wide Web.


This by the way is a method of the delegate class <AGSGPSInfoTemplateDelegate>. Please help! Thanks.
0 Kudos
TOSPOLTOOMMALA
New Contributor
Just return UIView.This is a sample in my iPad app.

-(UIView *)customViewForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)mapPoint{
   
    if ([graphic.layer.name isEqualToString:@"spb_amphor_sm1"]) {
        NSArray *ampInfo = [NSArray arrayWithObjects:[graphic.attributes objectForKey:colCTLSUM],[graphic.attributes objectForKey:colCOWSUM],[graphic.attributes objectForKey:colBUFSUM],[graphic.attributes objectForKey:colPIGSUM],[graphic.attributes objectForKey:colCHCSUM],[graphic.attributes objectForKey:colDCKSUM],[graphic.attributes objectForKey:colGOASUM],[graphic.attributes objectForKey:colSHPSUM],[graphic.attributes objectForKey:colOTHSUM], nil];
        UIView *oldView = [self.view viewWithTag:102];
        if (oldView != nil) {
            [oldView removeFromSuperview];
        }
        if (infoType == 0) {

            AGSPopupsContainerViewController *popView = [[AGSPopupsContainerViewController alloc] initWithPopupInfo:[self.webmap popupInfoForFeatureLayer:graphic.layer] graphic:graphic usingNavigationControllerStack:NO];
            popView.delegate = self;
            return popView.view;

        } else if (infoType == 1) {
            BarAnimal *info = [[BarAnimal alloc] initWithNibName:@"ChartSample" bundle:nil];
            [info DataBind:ampInfo];
            info.title = [graphic.attributes objectForKey:colAmpnamethai];
            [info.view setFrame:CGRectMake(0, 0, 420, 260)];
            return info.view;
        } else {
            ChartSample *info = [[ChartSample alloc] initWithNibName:@"ChartSample" bundle:nil];
            [info DataBind:ampInfo];
            info.title = [graphic.attributes objectForKey:colAmpnamethai];
            [info.view setFrame:CGRectMake(0, 0, 280, 280)];
            return info.view;
        }

    } else {
        AGSPopupsContainerViewController *popView = [[AGSPopupsContainerViewController alloc] initWithPopupInfo:[self.webmap popupInfoForFeatureLayer:graphic.layer] graphic:graphic usingNavigationControllerStack:NO];
        popView.delegate = self;
        return popView.view;
    }
}
0 Kudos
MakhdoomZia
New Contributor
Just return UIView.This is a sample in my iPad app.

-(UIView *)customViewForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)mapPoint{
   
    if ([graphic.layer.name isEqualToString:@"spb_amphor_sm1"]) {
        NSArray *ampInfo = [NSArray arrayWithObjects:[graphic.attributes objectForKey:colCTLSUM],[graphic.attributes objectForKey:colCOWSUM],[graphic.attributes objectForKey:colBUFSUM],[graphic.attributes objectForKey:colPIGSUM],[graphic.attributes objectForKey:colCHCSUM],[graphic.attributes objectForKey:colDCKSUM],[graphic.attributes objectForKey:colGOASUM],[graphic.attributes objectForKey:colSHPSUM],[graphic.attributes objectForKey:colOTHSUM], nil];
        UIView *oldView = [self.view viewWithTag:102];
        if (oldView != nil) {
            [oldView removeFromSuperview];
        }
        if (infoType == 0) {

            AGSPopupsContainerViewController *popView = [[AGSPopupsContainerViewController alloc] initWithPopupInfo:[self.webmap popupInfoForFeatureLayer:graphic.layer] graphic:graphic usingNavigationControllerStack:NO];
            popView.delegate = self;
            return popView.view;

        } else if (infoType == 1) {
            BarAnimal *info = [[BarAnimal alloc] initWithNibName:@"ChartSample" bundle:nil];
            [info DataBind:ampInfo];
            info.title = [graphic.attributes objectForKey:colAmpnamethai];
            [info.view setFrame:CGRectMake(0, 0, 420, 260)];
            return info.view;
        } else {
            ChartSample *info = [[ChartSample alloc] initWithNibName:@"ChartSample" bundle:nil];
            [info DataBind:ampInfo];
            info.title = [graphic.attributes objectForKey:colAmpnamethai];
            [info.view setFrame:CGRectMake(0, 0, 280, 280)];
            return info.view;
        }

    } else {
        AGSPopupsContainerViewController *popView = [[AGSPopupsContainerViewController alloc] initWithPopupInfo:[self.webmap popupInfoForFeatureLayer:graphic.layer] graphic:graphic usingNavigationControllerStack:NO];
        popView.delegate = self;
        return popView.view;
    }
}


Thanks a bunch. If I want to just display callouts on a map for addresses in a city (already found by geocoding) and I want to display an image, a title and a few lines of text (name, position, etc) in each point's callout, what would be the best approach/work flow using this method?
0 Kudos