我正在使用教程来构建我的第一个应用程序.http://www.raywenderlich.com/90971/introduction-mapkit-swift-tutorial
我搜索了pintintcolor但没有出现.
基本上,本教程使用此代码来设置颜色
// pinColor for disciplines: Sculpture, Plaque, Mural, Monument, other
func pinColor() -> MKPinAnnotationColor{
switch discipline {
case "Sculpture", "Plaque":
return .Red
case "Mural", "Monument":
return .Purple
default:
return .Green
Run Code Online (Sandbox Code Playgroud)
麻烦就是这就是苹果在开发者网站上的含义
https://developer.apple.com/library/mac/releasenotes/General/APIDiffsMacOSX10_11/Swift/MapKit.html
修改了MKPinAnnotationView声明
从:
class MKPinAnnotationView : MKAnnotationView {
var pinColor: MKPinAnnotationColor
var animatesDrop: Bool
}
Run Code Online (Sandbox Code Playgroud)
至:
class MKPinAnnotationView : MKAnnotationView {
class func redPinColor() -> NSColor
class func greenPinColor() -> NSColor
class func purplePinColor() -> NSColor
var pinTintColor: NSColor!
var animatesDrop: Bool
var pinColor: MKPinAnnotationColor
} …Run Code Online (Sandbox Code Playgroud)