performSegueWithIdentifier

performSegueWithIdentifier

我已经设置了一个“显示细节”从一个视图控制器到另一个视图控制器的序列。但是,当我执行以下代码时,没有任何反应,它没有显示viewController。我100%认为segue中的标识符是相同的。这能做什么呢?

self.performSegueWithIdentifier("PresentPermissionView", sender: self)


我用这种方法称呼它

func determinePermission() {

    switch CLLocationManager.authorizationStatus() {

    case .AuthorizedAlways, .AuthorizedWhenInUse:
        if CLLocationManager.locationServicesEnabled() {

        }

    case .NotDetermined:
        locationManager.requestWhenInUseAuthorization()
        print("test")
    case .Restricted, .Denied:

        print("restricted")
        self.performSegueWithIdentifier("PresentPermissionView", sender: self)

    }
}

最佳答案

您在哪里调用此方法?

尝试通过覆盖来记录它是否真的准备进行segue:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
{
    print("Preparing for segue using: \(segue)")
    print("With it's destination view controller: \(segue.destinationViewController)")
}

override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool
{
    return true
}

关于ios - performSegueWithIdentifier未提供所需的 View ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35116003/

10-11 17:50