i`m using MapKit framework and i want to ask you about something :
+ (NSUInteger)zoomLevelForMapRect:(MKMapRect)mRect withMapViewSizeInPixels:(CGSize)viewSizeInPixels
{
NSUInteger zoomLevel = MAXIMUM_ZOOM; // MAXIMUM_ZOOM is 20 with MapKit
MKZoomScale zoomScale = mRect.size.width / viewSizeInPixels.width; //MKZoomScale is just a CGFloat typedef
double zoomExponent = log2(zoomScale);
zoomLevel = (NSUInteger)(MAXIMUM_ZOOM - ceil(zoomExponent));
return zoomLevel;
}
this method..how can i know the value of mRect and viewSizeInPixels parameters to be able to call it?? thx in advance 🙂
The map view’s current MKMapRect is the visibleMapRect property and the view size would be in frame.size (since MKMapView is a subclass of UIView) so the method would be called using something like:
UtilityClassis whatever class that method is in and replacemapViewwith whatever you map view is actually named.By the way, the MapKit Framework Reference and the Location Awareness Programming Guide are worth looking at.