I see this post is six years old...but...here's how I did it:
func addPolyLine(coordArray: [CLLocationCoordinate2D], count: Int, name: String){
let polyline = MKPolyline(coordinates: coordArray, count: count)
polyline.title = name
self.cruiseMap.delegate = self
self.cruiseMap.addOverlay(polyline)
}
func addSemiCircle(centerCoord: CLLocationCoordinate2D, r: Double, startBearing: Double, title: String){ // r in feet, bearings in degrees
var dots: [CLLocationCoordinate2D] = [N777.location, N777.location,N777.location,N777.location,N777.location,N777.location,N777.location,N777.location, N777.location,N777.location,N777.location,N777.location,N777.location]
// N777 is a structure, one of its variables is "location" which is a CLLocationCoordinate2D
let radianInc = 15*degreesToRadians
for dot in 0...12{
dots[dot] = locationWithBearing(bearing: startBearing*degreesToRadians + (Double(dot)*radianInc), distanceMeters: r*feetToMeters, origin: centerCoord)
}
addPolyLine(coordArray: dots, count: 13, name: title)
}
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if let polyline = overlay as? MKPolyline {
let lineRenderer = MKPolylineRenderer(polyline: polyline)
lineRenderer.alpha = 1.0
lineRenderer.strokeColor = polyLineColor
lineRenderer.lineWidth = polyLineWidth
return lineRenderer
}
return MKOverlayRenderer()
}
Post
Replies
Boosts
Views
Activity
I have the same issue. Xcode 14.3. Any resolution?
This thread is 4 years old now, is it still true that, "it is impossible to get the behaviour that contacts and Pages files exhibit, whereby the icon is shown in Mail and tapping on the icon opens the relevant app. Mail is specifically programmed to handle those file types differently from others." ? My app is an iOS app. Currently running Xcode 14.3 and iOS 16.4.1.
I have the same problem. Both of my Pickerviews spill outside their defined sizes and make my app interface look bad. There is no option for a "constraint layout." Only autoresizing mask and inferred autoresizing mask. The other problem is the picker view does not show up where its X and Y coordinates indicate, but about 50 below the Y coordinate.
"pageToSet" and "parameterToSet" are passed in as integers. I checked their values when the code crashes and both are valid numbers (pageToSet is 2, parameterToSet is 1, and source is "i "). Next time it blows up I'll try and get the crash log. Here is the whole function:
public func updateParameterStatus(pageToSet: Int, parameterToSet: Int, source: String){
if (pageToSet >= 1) && (pageToSet <= 10) && (parameterToSet >= 1) && (parameterToSet <= 20){
page[pageToSet].parameter[parameterToSet].source = source // this line crashes sometimes on start up for some reason
if source == "t "{
page[pageToSet].parameter[parameterToSet].isComputed = true
} else {
page[pageToSet].parameter[parameterToSet].isComputed = false
}
page[pageToSet].parameter[parameterToSet].timeStamp = N777.currentTime.timeIntervalSinceReferenceDate
page[pageToSet].parameter[parameterToSet].isValid = true
page[pageToSet].parameter[parameterToSet].isStale = false
if source == "i " || source == "d " {
page[pageToSet].parameter[parameterToSet].isImported = true
} else {
page[pageToSet].parameter[parameterToSet].isImported = false
}
page[pageToSet].parameter[parameterToSet].hasBeenEntered = true
}
}
Same issue here. iMac (Retina 5K, 27-inch, 2019), OS 11.6, iPhone 13 Pro running iOS 15.1.1