0
var view: MKPinAnnotationView
view.rightCalloutAccessoryView = UIButton.buttonWithType(.DetailDisclosure) as! UIView
問題我是新來的swift。在我參加在線教程(https://www.raywenderlich.com/90971/introduction-mapkit-swift-tutorial)時,上面代碼的第二行給出了以下問題;Swift - 使用buttonWithType和
buttonWithType
未被識別。因此我使用的是buttonType: UIButtonType
,但它仍然給我一個錯誤在同一行代碼
as!
產生一個錯誤。
鏈接教程中的代碼是用Swift 2編寫的。如果您使用的是Swift 3,則需要將代碼轉換爲新的語法。 – vadian