【发布时间】:2016-12-16 03:26:17
【问题描述】:
我收到错误:“类 'ViewController' 没有初始化程序”。我已将问题缩小到正在调用的这个函数。有没有人看到问题?
let locationManager1: CLLocationManager // your location manager
func addBoundry(loc: CLLocation)
{
if let loc: CLLocation! = locationManager1.location {
let center: CLLocationCoordinate2D = loc!.coordinate
let lat: CLLocationDegrees = center.latitude
let long: CLLocationDegrees = center.longitude
var points = [CLLocationCoordinate2DMake(lat,long),CLLocationCoordinate2DMake(lat,long),CLLocationCoordinate2DMake(lat,long),CLLocationCoordinate2DMake(lat,long)]
let polygon = MKPolygon(coordinates: &points, count: points.count)
mapView.addOverlay(polygon)
} else {
print("no location...")
}
}
【问题讨论】:
标签: ios swift xcode viewcontroller initializer