UIMapView有一个委托集,但它永远不会被调用

时间:2015-12-06 10:51:27

标签: ios objective-c mkmapview

我创建了一个UIMapView并设置了委托,但它并没有被称为mapview的委托。

#import <MapKit/MapKit.h>
@interface MapViewController : UIView <MKMapViewDelegate>
- (id)initWith_Latitude:(NSString *)Latitude Longitude:(NSString *)Longitude;

- (id)initWith_Latitude:(NSString *)Latitude Longitude:(NSString *)Longitude
{
    CGRect frame = CGRectMake(0, 0, 200, 200);
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        mapView = [[MKMapView alloc] initWithFrame:frame];
        MKCoordinateRegion mapRegion;
        [mapView setUserInteractionEnabled:YES];
        [mapView setDelegate:self];
        mapRegion.center.latitude = [Latitude doubleValue];
        mapRegion.center.longitude = [Longitude doubleValue];
        mapRegion.span.latitudeDelta = 0.005;
        mapRegion.span.longitudeDelta = 0.005;
        mapView.region = mapRegion;
        [self addSubview:mapView];
    }
    return self;
}
不调用

委托:

- (void)mapViewDidFinishRenderingMap:(MKMapView *)mapView2 fullyRendered:(BOOL)fullyRendered{
    NSLog(@"abc...");
}

如何解决这个问题,请帮助我。

0 个答案:

没有答案