我现在正盯着把头发拉过这个,所以一些帮助会非常感激。
我有一个segue(从右边滑动),它完美地工作,并从右侧滑入一个新的// add the rule here
$.validator.addMethod("valueNotEquals", function(value, element, arg){
return arg !== value;
}, "Value must not equal arg.");
// configure your validation
$("gender").validate({
rules: {
jk: { valueNotEquals: "default" }
},
messages: {
jk: { valueNotEquals: "Please select an item!" }
}
});
进入视图。
我现在正尝试使用以下自定义类返回展开 segue。
一切似乎都运转正常,我可以看到第一个视图从左侧滑回,但问题是它会立即从视图中消失。
我唯一的 view
来电是dismiss
,在下面的展开课程中,我正在想要解除这一观点。< / p>
originalVC
编辑:根据下面的编辑将视图添加到//Segue: Unwind From Right
class UnwindSegueFromRight: UIStoryboardSegue {
override func perform(){
let originalVC = self.source
let destinationVC = self.destination
originalVC.view.superview?.insertSubview(destinationVC.view, aboveSubview: originalVC.view)
destinationVC.view.transform = CGAffineTransform(translationX: -originalVC.view.frame.size.width, y: 0)
UIView.animate(withDuration: 0.25,
delay: 0.0,
options: UIViewAnimationOptions.curveEaseInOut,
animations: {
destinationVC.view.transform = CGAffineTransform(translationX: 0, y: 0)
},
completion: { finished in
originalVC.dismiss(animated: false, completion: nil)
})
}
}//end class
引入了一系列新问题,keyWindow
在我放松时从视图中消失。
tabBar
这是class UnwindSegueFromRight: UIStoryboardSegue {
override func perform(){
let originalVC = self.source
let destinationVC = self.destination
UIApplication.shared.keyWindow?.insertSubview(destinationVC.view, aboveSubview: originalVC.view)
destinationVC.view.transform = CGAffineTransform(translationX: -originalVC.view.frame.size.width, y: 0)
UIView.animate(withDuration: 0.25,
delay: 0.0,
options: UIViewAnimationOptions.curveEaseInOut,
animations: {
destinationVC.view.transform = CGAffineTransform(translationX: 0, y: 0)
},
completion: { finished in
originalVC.dismiss(animated: false, completion: nil)
})
}
}//end class
类,它是初始的segue
SegueFromRight
答案 0 :(得分:0)
您已将destinationVC.view
添加到originalVC
,因此当您解雇originalVC
时,您还要删除destinationVC.view
。
换句话说:
在originalVC
致电解雇之前,您必须致电:
destinationVC.view.removeFromSuperview()