【发布时间】:2014-06-09 06:32:27
【问题描述】:
很高兴看到 swift-playground 的标签 - 很高兴看到这种情况继续下去。
我一直在修改 Swift,想知道 MapKit 是否可以在操场上使用,以便您可以使用快速查看功能,以便我可以迭代并预览我的工作。我还没有弄清楚语法所以想我会问是否有人在游乐场环境中探索过这个。我想我需要一些代码来将其建立为视图控制器。
import UIKit
import MapKit
// Sample UIView code which works great in the playground.
//var myView:UIView = UIView();
//myView.frame = CGRectMake(0, 0, 320, 560)
//myView.backgroundColor = UIColor.blueColor()
// Non working map code - no errors but can't figure out what to call or initiate to get the view in the Quick Look side.
var mapView = MKMapView();
mapView.region.center.latitude = mapView.userLocation.coordinate.latitude;
mapView.region.center.longitude = mapView.userLocation.coordinate.longitude;
mapView.region.span.latitudeDelta = 0.00725;
mapView.region.span.longitudeDelta = 0.00725;
猜想我只是缺少一些简单的 mapView 自身初始化等。我喜欢解释的操场区域进行修补,只需要弄清楚它是否可以执行 mao 功能,而不是仅仅在其中编写 .swift 文件和环境Xcode 并变得更加正式。
【问题讨论】:
-
stackoverflow.com/questions/24108093/… 建议游乐场不是交互式的。
-
也许本教程可以帮助您解决问题:appshocker.com/…
-
实际上,当添加一行仅包含 mapView 的行时,它确实在错误控制台中显示了错误,但我无法为它们搜索解决方案。我也试过 XCPShowView("Map", mapView) 没有运气
-
你解决过这个问题吗?
标签: swift mapkit swift-playground