首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MapView在注释中显示了无与伦比的数据?

MapView在注释中显示了无与伦比的数据?
EN

Stack Overflow用户
提问于 2013-04-22 11:40:09
回答 1查看 41关注 0票数 0

我是iPhone编程的新手,我正在练习MKMapView.But,它显示的是未使用的数据。我有两个ViewControllers。在第一个ViewController上,我们有一个按钮,下面写了这样的代码:-有两个数组,其数据如下所示:- DetailArray:- inNetwork = true;

代码语言:javascript
复制
    resName = taverna1;  
    statusColor = "#FF0000";
    statusString = "30 MIN";
    true = hasPromo;
},
    {
    false = hasPromo;
    inNetwork = true;
    resName = bungalow;
    statusColor = 00FF00;
    statusString = "NO WAIT";
},
    {
    inNetwork = true;
    resName = "casa_nostra";
    statusColor = 00FF00;
    statusString = "NO WAIT";
    true = hasPromo;
},
    {
    inNetwork = true;
    resName = karebu;
    statusColor = 00FF00;
    statusString = "NO WAIT";
    true = hasPromo;
}




**Annotation Array**

(
    "<MyAnnotViewController: 0x8457b60>",
    "<MyAnnotViewController: 0x845a040>",
    "<MyAnnotViewController: 0x84439f0>",
    "<MyAnnotViewController: 0x806f090>"
)

MyAnnoationViewcontroller是MKAnnotation.It的子类,成功地包含标题和坐标。

代码语言:javascript
复制
  SecondViewController *_SecondViewController =[[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
    _SecondViewController.DetailArray = detailArray;
    _SecondViewController.annotationArray = annotationArray;
     [self.navigationController pushViewController:_SecondViewController animated:YES];

关于第二视图控制器:-

代码语言:javascript
复制
MKMapView * MapView =[[MKMapView alloc]initWithFrame:CGRectMake(0, 0, 320, 415)];
MapView.delegate =self;
MapView.showsUserLocation =NO;

[MapView addAnnotations:annotationArray];

[self.view addSubview:MapView];

在委托方法上,它在annotations.Chlorinates上显示了非常不确定的结果,并且标题是期望的输出。但是第一个rest名字的颜色是第二个餐厅的颜色,第二个是其他的颜色。请任何人帮助我摆脱这个问题。我会感谢你的帮助。

EN

回答 1

Stack Overflow用户

发布于 2013-04-22 21:27:29

您还没有显示viewForAnnotation的代码,所以我将在黑暗中尝试一下,猜测您正在根据数组的顺序而不是传递给viewForAnnotation的注释对象设置要绘制的视图的颜色。您可以在viewForAnnotation上找到很多关于StackOverflow的问题。

你真的在使用iOS 4.0吗?好旧啊。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16146284

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档