Код: Выделить всё
import UIKit
class LocationInformationCalloutView: UIView {
:
:
Код: Выделить всё
class LocationInformationAnnotationView: MKAnnotationView {
weak var customCalloutView : LocationInformationCalloutView?
}
}
:
:
Функция loadLocationInformationCalloutView() выглядит следующим образом (просто функция, которая возвращает UIView):
Код: Выделить всё
func loadLocationInformationCalloutView() -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: 240, height: 280))
return view
}
Код: Выделить всё
self.customCalloutView = newCustomCalloutView
Код: Выделить всё
override func setSelected(_ selected: Bool, animated: Bool) {
if selected {
self.customCalloutView?.removeFromSuperview()
if let newCustomCalloutView = loadLocationInformationCalloutView() {
newCustomCalloutView.frame.origin.x -= newCustomCalloutView.frame.width / 2.0 - (self.frame.width / 2.0)
newCustomCalloutView.frame.origin.y -= newCustomCalloutView.frame.height
self.addSubview(newCustomCalloutView)
self.customCalloutView = newCustomCalloutView
if animated {
self.customCalloutView!.alpha = 0.0
UIView.animate(withDuration: 1.8, animations: {
self.customCalloutView!.alpha = 1.0
})
Невозможно присвоить значение типа «UIView» типу «LocationInformationnCalloutView?»
Может ли кто-нибудь пролить свет на этот вопрос и помочь мне решить эту проблему? Любая помощь будет очень признательна, спасибо!
Подробнее здесь: https://stackoverflow.com/questions/524 ... -to-uiview
Мобильная версия