无法将这行 objective-c 代码转换为Swift

for (id <MKAnnotation> annotation in mapView.annotations) {
    // Do Something
}

当我尝试:
for (annotation:MKannotation in mapView.annotations)

要么
for (annotation in mapView.annotations)

我得到:预期为';'在“for”语句中

谢谢!!

最佳答案

答案是:

for annotation in mapView.annotations as [MKAnnotation] {...}

关于ios - 如何在Swift中循环mapView.Annotations?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27338514/

10-09 03:36