我正试图在我的VenueListVC
和VenueDetailsVC
之间左右移动。但是当我使用带有指定类的'Application tried to present modally an active controller <VenueDetailsVC: 0x104098980>.'
segue回到原始VC时,我收到以下错误: SegueFromLeft
。
我有以下课程; SegueFromRight
从右侧转换目标VC并为其设置动画,并在其正下方SegueFromLeft
类,旨在实现类似的功能,而不是通过添加&#39; - &#39;来自左侧的translationX: -src.view.frame.size.width
类。减去class SegueFromRight: 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: .curveEaseInOut,
animations: {
dst.view.transform = CGAffineTransform(translationX: 0, y: 0)
},
completion: { finished in
src.present(dst, animated: false, completion: nil)
}
)
}
。
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: .curveEaseInOut,
animations: {
dst.view.transform = CGAffineTransform(translationX: 0, y: 0)
},
completion: { finished in
src.present(dst, animated: false, completion: nil)
}
)
}
}
prepareForUnwind
}
我的VenueListVC
(来源VC)中有以下@IBAction func prepareForUnwind (segue: UIStoryboardSegue){
}
IBAction
VenueDetailsVC
我使用prepareForUnwind
(目标VC)中的退出点链接到VenueListVC
(来源VC)的SegueFromLeft
IBaction。
我已将{{1}}类添加到segue。
producer configuration setting
Segue right完美无缺,当我向后推进时,它会抛出上面的错误,但不会在呈现源VC之前抛出错误。