我在尝试创建自定义segue时遇到了问题。我从教程中复制了以下代码:
import UIKit
class SegueFromLeft: UIStoryboardSegue
{
override func perform()
{
let src = self.source
let dst = self.destination
src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
dst.view.transform = CGAffineTransform(translationX: -src.view.frame.size.width, y: 0)
UIView.animate(withDuration: 0.25,
delay: 0.0,
options: UIViewAnimationOptions.curveEaseInOut,
animations: {
dst.view.transform = CGAffineTransform(translationX: 0, y: 0)
},
completion: { finished in
src.present(dst, animated: true, completion: nil)
}
)
}
}
但是,我认为我已经诊断出问题,即我已经创建了一个嵌入导航控制器中的视图控制器的segue。我如何调整代码来解决这个问题?
致电:
@IBAction func sendToSignUp(_ sender: UIButton) {
performSegue(withIdentifier: NameFile.Segues.segueToSignUpP1, sender: sender)
}