This category rectifies that.
MKMapView-CoordsDisplay.h
MKMapView-CoordsDisplay.m
#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
Posted in: Categories,MapKit
Kirimkan Ini lewat Email
BlogThis!
Bagikan ke X
Berbagi ke Facebook
0 komentar:
Posting Komentar