This category rectifies that.
MKMapView-CoordsDisplay.h
MKMapView-CoordsDisplay.m
Iphone information
Home » MapKit » MKMapView Category
#import <MapKit/MapKit.h>
@interface MKMapView(CoordsDisplay)
- (BOOL)coordinatesInRegion:(CLLocationCoordinate2D)coords;
@end
#import "MKMapView-CoordsDisplay.h"
@implementation MKMapView(CoordsDisplay)
- (BOOL)coordinatesInRegion:(CLLocationCoordinate2D)coords
{
CLLocationDegrees leftDegrees = self.region.center.longitude - (self.region.span.longitudeDelta / 2.0);
CLLocationDegrees rightDegrees = self.region.center.longitude + (self.region.span.longitudeDelta / 2.0);
CLLocationDegrees bottomDegrees = self.region.center.latitude - (self.region.span.latitudeDelta / 2.0);
CLLocationDegrees topDegrees = self.region.center.latitude + (self.region.span.latitudeDelta / 2.0);
return leftDegrees <= coords.longitude && coords.longitude <= rightDegrees && bottomDegrees <= coords.latitude && coords.latitude <= topDegrees;
}
@end
© 2010 Iphone information - All Rights Reserved
Wordpress by Chris Pearson - Converted to Blogger by Belajar SEO Blogspot - Seo Blogger
{ 0 comments... Views All / Send Comment! }
Post a Comment