请问MKMapView 点击大头针后 弹出的标志信息view 如何自定义

sike200008 2012-03-09 12:38:30
google找了很久了 都没找到

求各路大侠 有知道实现的 给个指引 小弟先行谢过了
...全文
545 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
mine0623 2012-08-17
  • 打赏
  • 举报
回复
xcode help 里面找一个叫 "MapCallouts" 的 Sample Code。
主要是MapViewController里面的
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
这个函数
楼上说的就是其中的一段代码。
ZivDo 2012-04-22
  • 打赏
  • 举报
回复
在- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation方法中写
[rightButton addTarget:self
action:@selector(showDetails:) //点击右边的按钮之后,显示另外一个页面
forControlEvents:UIControlEventTouchUpInside];

在外面简历一个showDetails的函数
- (void)showDetails:(id)sender;
newlcc 2012-03-12
  • 打赏
  • 举报
回复
先在地图上确定你的坐标。然后设置图钉,在设置点击图钉出现的界面,设置点击界面中的元素,做对应的操作。
newlcc 2012-03-12
  • 打赏
  • 举报
回复
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
MapAnnotation *annotation = view.annotation;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:annotation.urlstring]];
}
newlcc 2012-03-12
  • 打赏
  • 举报
回复
@interface MapAnnotation : NSObject <MKAnnotation>
{
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
NSString *urlstring;
NSString *picstring;
}
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *subtitle;
@property (nonatomic, retain) NSString *urlstring;
@property (nonatomic, retain) NSString *picstring;
@end

#import "MapAnnotation.h"


@implementation MapAnnotation
@synthesize coordinate;
@synthesize title;
@synthesize subtitle;
@synthesize urlstring;
@synthesize picstring;

- (id) initWithCoordinate: (CLLocationCoordinate2D) aCoordinate
{
if (self = [super init]) coordinate = aCoordinate;
return self;
}

-(void) dealloc
{
self.title = nil;
self.subtitle = nil;
self.urlstring = nil;
self.picstring = nil;
[super dealloc];
}
@end
sike200008 2012-03-12
  • 打赏
  • 举报
回复
我查了资料 应该是自定义 callout 但是这个怎么弄呢?
sike200008 2012-03-09
  • 打赏
  • 举报
回复
1楼 能说得详细点吗?
newlcc 2012-03-09
  • 打赏
  • 举报
回复
MapAnnotation

29,027

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧