Bug Report: mapview setFrame

334
1
10-30-2011 10:30 AM
JeremyBixby
New Contributor III
When I instantiate an AGSMapView like this:

AGSMapView *mapview = [[AGSMapView alloc] init];


later calling "setFrame" like this:

[_mapView setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 325)];


produces the following error, when I try to interact with the map object (e.g. autoPan = YES, zoom in/out, or manually pan the map) after I make the setFrame call:

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'


Instantiating the AGSMapView and setting the frame all at once, on the other hand, produces the correct results:

_mapView = [[AGSMapView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 325)];


I can work around it; if it is in fact a bug, I thought you would like to know.
0 Kudos
1 Reply
PaulLohr
Occasional Contributor III
I am still new to this - maybe it is a chance for me to learn. I could be all wrong on this, Jeremy.

The way I understand how ESRI separates class properties and instance variables is like this:
<mapView> - class property
<_mapView> - instance variable.
This can be seen in the synthesize statement and the header file.

Usually I setup and use the property like this: [self.mapView goDoSomething];

In your example, it looks like you may have alloc/init'd a method variable while you probably also have a class property and instance variable available for use. This assumes you use the ESRI convention of setting up all of these in your header file and synthesize statement.
0 Kudos