ios - 一旦执行停止 performseguewithidentifier

标签 ios swift uiview ibeacon

我有这段代码可以使用信标更新距离。

func updateDistance(distance: CLProximity) {
    UIView.animateWithDuration(0.8) {
        switch distance {
        case .Unknown:
            print("unknown")
        case .Far:
            print("far")
        case .Near:
            print("near")
        case .Immediate:
             print("Immediate")
             self.performSegueWithIdentifier("beaconSegue", sender: self)
        }
    }
}

我只想问一下,如果已经执行了 self.performSegueWithIdentifier 函数,如何停止它。

最佳答案

如果你想阻止performSegueWithIdentifier,你可以这样做:

override func shouldPerformSegueWithIdentifier(identifier: String,sender: AnyObject?) -> Bool {
    if ... { // Set the condition if you want it can be perform
        return true
    } else {
        return false
    }
}

关于ios - 一旦执行停止 performseguewithidentifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36689343/

相关文章:

objective-c - 如何在 View 消失时暂停并重新启动 NSTimer?

ios - iOS 启动屏幕中心黑屏

ios - UIImageView Tap Gesture 在第二次点击时不起作用

swift - 如何在 Swift 中共享流位置 betwixt 函数?

ios - 无法在 swiftUI 的剪辑形状中使用旋转效果

ios - 如何停止和反转 UIView 动画?

ios - 在屏幕 ios7 之间转换时边缘闪烁

ios - Swift:从另一个 viewController 类访问枚举

iphone - 将桶形失真应用于 UIView

objective-c - UINavigationItem 不显示事件指示器