Swift performSegue 转到 Xcode [英] Swift performSegue going to Xcode

查看:28
本文介绍了Swift performSegue 转到 Xcode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

这是一个断点.当执行路径到达一个处于活动状态的断点(像这样的纯蓝色)时,我们在那里暂停.这就是断点用于.

如果您不希望发生这种情况,请将断点拖出装订线.

I am trying to perform a Segue between two UI Views I have correctly typed the identifier for the segue as can be seen Here

This is my function, with the same identifier "no" but when the button is clicked in the simulator it simply shows This (It looks like it is showing the stack in bottom left?)

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

I have attached my full code incase further analysis is needed. Thanks for your help.

View Controller: import UIKit import MapKit import CoreLocation

class 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)
    }
}


}

Any help appreciated.

解决方案

See the solid blue bar in the gutter in your screen shot?

It is a breakpoint. When the path of execution reaches a breakpoint that is active (solid blue like this), we pause there. That is what a breakpoint is for.

If you don't want that to happen, drag the breakpoint out of the gutter.

这篇关于Swift performSegue 转到 Xcode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆