Ios5 右侧附件按钮未显示
我尝试管理注释,并在选择PIN时在视图右侧显示信息按钮,我的相关代码如下:Ios5 右侧附件按钮未显示,ios5,mkmapview,mkannotation,mkannotationview,Ios5,Mkmapview,Mkannotation,Mkannotationview,我尝试管理注释,并在选择PIN时在视图右侧显示信息按钮,我的相关代码如下: - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIde
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation {
MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"greenPin"];
if ([annotation isKindOfClass:[ManageAnnotations class]]) {
static NSString* identifier = @"ManageAnnotations";
MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
if (newAnnotation==nil) {
newAnnotation=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
}else {
newAnnotation.annotation=annotation;
}
newAnnotation.pinColor = MKPinAnnotationColorGreen;
newAnnotation.animatesDrop = YES;
newAnnotation.canShowCallout = YES;
newAnnotation.rightCalloutAccessoryView=[UIButton buttonWithType:UIButtonTypeInfoLight];
return newAnnotation;
}else {
newAnnotation.pinColor = MKPinAnnotationColorGreen;
newAnnotation.animatesDrop = YES;
newAnnotation.canShowCallout = YES;
return newAnnotation;
}
ManageAnnotations.h
@interface ManageAnnotations : NSObject<MKAnnotation>{
NSString *_storeName;
NSString *_storeAdress;
CLLocationCoordinate2D _coordinate;
}
//
@property(nonatomic,assign)MKPinAnnotationColor pinColor;
@property(nonatomic, readonly, copy)NSString *storeName;
@property(nonatomic, readonly, copy)NSString *storeAdress;
@property(nonatomic,readonly)CLLocationCoordinate2D coordinate;
//
-(id)initWithTitle:(NSString*)storeName adress:(NSString*)storeAdress coordinate:(CLLocationCoordinate2D)coordinate;
//
@接口管理器注释:NSObject{
NSString*\u storeName;
NSString*\u存储地址;
CLLocationCoordinate2D_坐标;
}
//
@属性(非原子,赋值)MKPinAnnotationColor pinColor;
@属性(非原子、只读、副本)NSString*storeName;
@属性(非原子、只读、副本)NSString*StoreAddress;
@属性(非原子,只读)CLLocationCoordinate2D坐标;
//
-(id)initWithTitle:(NSString*)存储名地址:(NSString*)存储地址坐标:(CLLocationCoordinate2D)坐标;
//
图钉在地图上显示正确,但视图右侧没有“信息”按钮。我错过什么了吗
除此之外,你的代码看起来不错,与我的相比,我看不出任何明显的变化。备注1是最可能的。我会设置一个断点,看看我是否真的去了那里,看看我是否可以显示一个leftCalloutAccessoryView,使用不同的pinColor。事实上,是的,我没有去那里,我用一个断点。请不要调用
viewForAnnotation
方法可能会出现什么问题?哦,我忘了设置委托:/Thanx为了您的帮助,问题解决了:))
@interface ManageAnnotations : NSObject<MKAnnotation>{
NSString *_storeName;
NSString *_storeAdress;
CLLocationCoordinate2D _coordinate;
}
//
@property(nonatomic,assign)MKPinAnnotationColor pinColor;
@property(nonatomic, readonly, copy)NSString *storeName;
@property(nonatomic, readonly, copy)NSString *storeAdress;
@property(nonatomic,readonly)CLLocationCoordinate2D coordinate;
//
-(id)initWithTitle:(NSString*)storeName adress:(NSString*)storeAdress coordinate:(CLLocationCoordinate2D)coordinate;
//