0
我现在从雨燕2.0传输iOS应用程序,以2.3和遇到问题就非常简单的事情......MKAnnotationView问题自initializiers(SWIFT转换到2.0 SWIFT 2.3)
这是我的AnnotationView类:
class PPLocationAnnotationView: MKAnnotationView {
private let annotationSize = CGSize(width: 60.0, height: 60.0)
init() {
let annotationFrame = CGRect(
origin: CGPointZero,
size: annotationSize)
super.init(frame: annotationFrame)
opaque = true
image = UIImage.annotationLocationIcon()
enabled = true
canShowCallout = false
centerOffset = CGPoint(x: 0.0, y: -(UIImage.annotationLocationIcon().size.height/2) + 10.0)
layer.shouldRasterize = true
layer.rasterizationScale = UIScreen.mainScreen().scale
}
}
这occures的错误是: “必须调用父类MKAnnotationView的指定初始化”
所以我改变此位:
convenience init(frame: CGRect) {
let annotationFrame = CGRect(
origin: CGPointZero,
size: annotationSize)
self.init(frame: annotationFrame)
现在我得到一个新的错误:“使用方法调用setupAudioSession'自我'的前super.init初始化自我”
我不明白这一点...
会很好,如果有人可以帮助。
欢呼