how to draw line between two points?

前端 未结 6 570
难免孤独
难免孤独 2021-01-03 14:43

i want to draw line between two points in my view how it possible.?

Edit:ya thax.i have got solution. Line draw perfectly.I want to draw multiple line with different

6条回答
  •  天命终不由人
    2021-01-03 15:17

    func locationManager(manager: CLLocationManager, didUpdateToLocation newLocation: CLLocation, fromLocation oldLocation: CLLocation)
    {
        let CurrentLogitude = String(format: "%.8f", newLocation.coordinate.longitude)
        //print(CurrentLogitude)
        let CurrentLatitude = String(format: "%.8f", newLocation.coordinate.latitude)
        // print(CurrentLatitude)
        //[self.locationManager stopUpdatingLocation];
    }
    func locationManager(manager: CLLocationManager, didFailWithError error: NSError)
    {
    }
    func locationManager(manager: CLLocationManager,
        didChangeAuthorizationStatus status: CLAuthorizationStatus)
    {
            var shouldIAllow = false
            var locationStatus :String
    
            switch status
            {
                case CLAuthorizationStatus.Restricted:
                    locationStatus = "Restricted Access to location"
                case CLAuthorizationStatus.Denied:
                    locationStatus = "User denied access to location"
                case CLAuthorizationStatus.NotDetermined:
                    locationStatus = "Status not determined"
                default:
                    locationStatus = "Allowed to location Access"
                    shouldIAllow = true
            }
    
            NSNotificationCenter.defaultCenter().postNotificationName("LabelHasbeenUpdated", object: nil)
            if (shouldIAllow == true)
            {
                NSLog("Location to Allowed")
                // Start location services
                locationManager.startUpdatingLocation()
            } else {
                NSLog("Denied access: \(locationStatus)")
            }
    }
    
    
    func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView?
    {
        let  pin = MKAnnotationView(annotation: annotation, reuseIdentifier: "locationpin")
        pin.image = UIImage(named: "locationpin.png")
    
        let notationView: UIView = UIView()
        notationView.frame = CGRectMake(0, 0, 400, 300)
        notationView.backgroundColor = UIColor.grayColor()
        pin.leftCalloutAccessoryView = notationView
        pin.canShowCallout = true
        return pin
    }
    

提交回复
热议问题