阅读背景:

类上符合MKAnnotation协议的自定义方法

来源:互联网 

I have a class:

我有一个类:

class MyAnnotion: NSObject, MKAnnotation {

let title: String?
let subtitle: String?
let item: MyCustomItem
let coordinate: CLLocationCoordinate2D

init(customItem: MyCustomItem, currentLocation: CLLocation)  {
    coordinate = item.coordinate
    pageId = "\(item.pageId)"
    title = "\(item.title)"
    item = myCustomItem
}

//TODO: Even though in mapView viewFor: the annotation is a WikiAnnotation, it wont recognize any custom function defined here
func imageUrl() -> String? {
    guard let url = item.imageUrl else {
        return nil
    }
    return url
}
}
class MyAnnotion: NS



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: