Swift执行Segue去Xcode

时间:2016-11-09 03:00:20

标签: swift xcode segue

我正在尝试在两个UI视图之间执行Segue我已经正确输入了segue的标识符Here

这是我的函数,具有相同的标识符“no”,但是当在模拟器中单击按钮时,它只显示This(看起来它在左下方显示堆栈?)

 func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
    if control == view.rightCalloutAccessoryView {
         performSegue(withIdentifier: "no", sender:self)
    }
}

我已附上我的完整代码,需要进一步分析。谢谢你的帮助。

查看控制器:     导入UIKit 导入MapKit 导入CoreLocation

类ViewController:UIViewController,MKMapViewDelegate,CLLocationManagerDelegate {

@IBOutlet weak var MapView: MKMapView!
let manager = CLLocationManager()

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    //let location = locations[0]


    //let span:MKCoordinateSpan = MKCoordinateSpanMake(0.02, 0.02)

    //let myLocation:CLLocationCoordinate2D = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude)


}
override func viewDidLoad() {
    super.viewDidLoad()

    // tracking user's location
    manager.delegate = self
    manager.desiredAccuracy = kCLLocationAccuracyBest
    manager.requestWhenInUseAuthorization()
    manager.startUpdatingLocation()

    // Setting up Map
    let distanceSpan:CLLocationDegrees = 2000
    MapView.setRegion(MKCoordinateRegionMakeWithDistance(CLLocationCoordinate2DMake(-39.0556253, 174.0752278), distanceSpan, distanceSpan), animated: true)
    MapView.showsUserLocation = true
    MapView.delegate = self

// artwork on map
    let windwandcoord: CLLocationCoordinate2D = CLLocationCoordinate2DMake(-39.055961,174.072288)
    let artworkPin = Artwork(title:"Wind Wand",locationName:"Majestic",discipline:"Statue",
                             coordinate:windwandcoord)
    MapView.addAnnotation(artworkPin)
}


func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?
{
    if annotation is MKUserLocation {return nil}

    let reuseId = "pin"

    var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId) as? MKPinAnnotationView
    if pinView == nil {
        pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
        pinView!.canShowCallout = true
        pinView!.animatesDrop = true
        pinView!.calloutOffset = CGPoint(x: -5, y: 5)
        let calloutButton = UIButton(type: .detailDisclosure)
        pinView!.rightCalloutAccessoryView = calloutButton
        pinView!.sizeToFit()
    }
    else {
        pinView!.annotation = annotation
    }


    return pinView
}



func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
    if control == view.rightCalloutAccessoryView {
         performSegue(withIdentifier: "no", sender:self)
    }
}


}

任何帮助表示感谢。

1 个答案:

答案 0 :(得分:2)

在屏幕截图中看到阴沟中的实心蓝条?

enter image description here

这是断点。当执行路径到达一个活动的断点(像这样的蓝色)时,我们暂停。这就是断点是 for

如果您不希望发生这种情况,请将断路器拖出