1
私はカスタムアニメーションをしたいと思っています。スウィフトのNSExceptionでSegueクラッシュを解消する
私はカスタムセグエのクラスを持っている:
import UIKit
import QuartzCore
class SegueFromRight: UIStoryboardSegue {
override func perform() {
let src: UIViewController = self.source
let dst: UIViewController = self.destination
let transition: CATransition = CATransition()
let timeFunc : CAMediaTimingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
transition.duration = 0.25
transition.timingFunction = timeFunc
transition.type = kCATransitionPush
transition.subtype = kCATransitionFromRight
src.navigationController!.view.layer.add(transition, forKey: kCATransition)
src.navigationController!.pushViewController(dst, animated: false)
}
}
私はアンワインドセグエ定義している:私はボタンの押しでセグエを呼び出す
@IBAction func unwindToGameOver(sender: UIStoryboardSegue) {
}
を:
@IBAction func backButtonPressed(_ sender: Any) {
performSegue(withIdentifier: "unwindToGameOver", sender: self)
}
ここに私のインターフェイスです巻き戻し用のビルダー:
これは、カスタムセグエは、私はそのクラスを削除するとアンワインドセグエが働くショーセグエ&に取り組んでいます「タイプNSExceptionのキャッチされない例外で終了する」
でクラッシュ。
アイデア?
完璧、ありがとう! –