<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using callouts programmatically with existing AGSGraphics in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-callouts-programmatically-with-existing/m-p/202001#M1835</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a tableView that holds an array of records that correspond with AGSGraphics which are in a mapView. The tableView and mapView are separate views. The goal here is to allow the user to tap the tableView's accessoryButton then the view changes to the mapView and a callout for the corresponding AGSGraphic shows. I can step through the code until I get to the first method in the infoTemplateDelegate. It is here that the Xcode gives the error message: "CALayer position contains NaN: [nan nan]". I am listing the code below in the order that it is stepped through.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have two graphics layers - one that holds the graphics on the map (myGraphicsLayer) and another that is used to show the callout (popupGraphicsLayer). This seems odd so perhaps this is where I have messed up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;pointsTableController.m&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:
(NSIndexPath *)indexPath {
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPS1AppDelegate *delegate = (GPS1AppDelegate *)[[UIApplication sharedApplication] delegate];
&amp;nbsp;&amp;nbsp;&amp;nbsp; mapViewController = [[MapView alloc] init];

&amp;nbsp;&amp;nbsp;&amp;nbsp; [delegate.navController pushViewController:mapViewController animated:YES];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSUInteger matchingObjectID;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( NSMutableDictionary *dict1 in pointRows )
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( [[dict1 valueForKey:@"dict_objectid"] isEqual:
[[pointRows objectAtIndex:indexPath.row] valueForKey:@"dict_objectid"]] )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; matchingObjectID = [[dict1 valueForKey:@"dict_objectid"] intValue];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [mapViewController selectThePoint:matchingObjectID];
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;MapView.m&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;-(void)selectThePoint:(NSUInteger)objectID
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.popupGraphicsLayer = [AGSGraphicsLayer graphicsLayer];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.mapView addMapLayer:self.popupGraphicsLayer withName:@"Popup Layer"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSGraphic *foundAGSGraphic;
&amp;nbsp;&amp;nbsp;&amp;nbsp; foundAGSGraphic = [[AGSGraphic alloc] init];
&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( AGSGraphic *graphicItem in self.myGraphicsLayer.graphics )
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( [[graphicItem.attributes valueForKey:@"dict_objectid"] intValue] == objectID )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foundAGSGraphic = graphicItem;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.popupGraphicsLayer addGraphic:foundAGSGraphic];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.popupGraphicsLayer dataChanged];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.mapView showCalloutAtPoint:nil forGraphic:foundAGSGraphic animated:YES];
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;infoTemplateDelegate.m&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
@implementation infoTemplateDelegate

-(NSString *)titleForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)map
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // when this is called from selectThePoint, Xcode returns 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // "CALayer position contains NaN:&amp;nbsp;&amp;nbsp; [nan nan]" when
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; the next line is stepped through.
&amp;nbsp; return [graphic.attributes valueForKey:@"dict_point_number"];
}

-(NSString *)detailForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)map
{
&amp;nbsp; return [graphic.attributes valueForKey:@"dict_comment"];
}

@end&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Paul Lohr&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 04 Dec 2011 08:46:21 GMT</pubDate>
    <dc:creator>PaulLohr</dc:creator>
    <dc:date>2011-12-04T08:46:21Z</dc:date>
    <item>
      <title>Using callouts programmatically with existing AGSGraphics</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-callouts-programmatically-with-existing/m-p/202001#M1835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a tableView that holds an array of records that correspond with AGSGraphics which are in a mapView. The tableView and mapView are separate views. The goal here is to allow the user to tap the tableView's accessoryButton then the view changes to the mapView and a callout for the corresponding AGSGraphic shows. I can step through the code until I get to the first method in the infoTemplateDelegate. It is here that the Xcode gives the error message: "CALayer position contains NaN: [nan nan]". I am listing the code below in the order that it is stepped through.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have two graphics layers - one that holds the graphics on the map (myGraphicsLayer) and another that is used to show the callout (popupGraphicsLayer). This seems odd so perhaps this is where I have messed up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;pointsTableController.m&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:
(NSIndexPath *)indexPath {
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPS1AppDelegate *delegate = (GPS1AppDelegate *)[[UIApplication sharedApplication] delegate];
&amp;nbsp;&amp;nbsp;&amp;nbsp; mapViewController = [[MapView alloc] init];

&amp;nbsp;&amp;nbsp;&amp;nbsp; [delegate.navController pushViewController:mapViewController animated:YES];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSUInteger matchingObjectID;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( NSMutableDictionary *dict1 in pointRows )
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( [[dict1 valueForKey:@"dict_objectid"] isEqual:
[[pointRows objectAtIndex:indexPath.row] valueForKey:@"dict_objectid"]] )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; matchingObjectID = [[dict1 valueForKey:@"dict_objectid"] intValue];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [mapViewController selectThePoint:matchingObjectID];
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;MapView.m&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;-(void)selectThePoint:(NSUInteger)objectID
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.popupGraphicsLayer = [AGSGraphicsLayer graphicsLayer];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.mapView addMapLayer:self.popupGraphicsLayer withName:@"Popup Layer"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSGraphic *foundAGSGraphic;
&amp;nbsp;&amp;nbsp;&amp;nbsp; foundAGSGraphic = [[AGSGraphic alloc] init];
&amp;nbsp;&amp;nbsp;&amp;nbsp; for ( AGSGraphic *graphicItem in self.myGraphicsLayer.graphics )
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( [[graphicItem.attributes valueForKey:@"dict_objectid"] intValue] == objectID )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foundAGSGraphic = graphicItem;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.popupGraphicsLayer addGraphic:foundAGSGraphic];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.popupGraphicsLayer dataChanged];
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.mapView showCalloutAtPoint:nil forGraphic:foundAGSGraphic animated:YES];
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;infoTemplateDelegate.m&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
@implementation infoTemplateDelegate

-(NSString *)titleForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)map
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // when this is called from selectThePoint, Xcode returns 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // "CALayer position contains NaN:&amp;nbsp;&amp;nbsp; [nan nan]" when
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; the next line is stepped through.
&amp;nbsp; return [graphic.attributes valueForKey:@"dict_point_number"];
}

-(NSString *)detailForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)map
{
&amp;nbsp; return [graphic.attributes valueForKey:@"dict_comment"];
}

@end&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Paul Lohr&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Dec 2011 08:46:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-callouts-programmatically-with-existing/m-p/202001#M1835</guid>
      <dc:creator>PaulLohr</dc:creator>
      <dc:date>2011-12-04T08:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using callouts programmatically with existing AGSGraphics</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-callouts-programmatically-with-existing/m-p/202002#M1836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If possible, please attach a sample application demonstrating the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2011 15:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-callouts-programmatically-with-existing/m-p/202002#M1836</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2011-12-05T15:45:43Z</dc:date>
    </item>
  </channel>
</rss>

