【发布时间】:2016-09-16 18:44:53
【问题描述】:
在我的出租车应用程序中,我创建了一个自定义 MKAnnotationView 来显示司机的估计位置。很简单:
#import <MapKit/MapKit.h>
@interface EstimatedArrivalView : MKAnnotationView
- (void)setText:(NSString *)min :(NSString *)time;
@end
但是,当我尝试在 ViewController 上实现以下代码时:
EstimatedArrivalView *av = [_fullScreenMapView viewForAnnotation:driverPoint];
[av setText:@"MIN" : [NSString stringWithFormat:@"%d", etaTimeCount]];
我收到以下警告:
Incompatible pointer types initializing 'EstimatedArrivalView *' with an expression of type 'MKAnnotationView * _Nullable'
据我了解,我将 EstimatedArrivalView 初始化为 MKAnnotationView。那么为什么会出现警告呢?
【问题讨论】:
标签: ios objective-c xcode mkannotationview