【问题标题】:How do I set the glyphimage of a MapKit annotation?如何设置 MapKit 注释的字形图像?
【发布时间】:2018-09-11 14:18:43
【问题描述】:

我知道这是基本的东西,但在线文档很薄。我是 Apple Mapkit 的新手,我正在尝试使用 glyphImage 覆盖创建一个简单的注释。我有注释工作,但是当我尝试设置 glyphImage 时,地图爆炸了。我使用的代码是:

testAnnotation.glyphImage = UIImage(named: "/public/img/site/tester.png");

我在这里做错了什么?

【问题讨论】:

  • “/public/img/site/tester.png”在哪里?
  • 如果使用 Asset Catalog 可以写UIImage(named: "tester")

标签: mapkit mapkitannotation


【解决方案1】:

我想通了:

var testAnnotation = new MarkerAnnotation(test, {
        title: "This is a Test!",
        subtitle: "Testing Apple MapKit",
        glyphImage: {
                1: "/images/testimage.png"
            }
        });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-06
    • 1970-01-01
    • 1970-01-01
    • 2011-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多