override func prepare(for segue:UIStoryboardSegue,sender:Any?){
}
ViewController中重写prepare(:,:)函数
storyboard中写segue的identifier
其中有转场动画有Cover Vertical(垂直覆盖),Cross Dissolve(交叉溶解),Flip Horizontal(水平翻转)
解除(Unwind) Segue:
使用Unwind Segue需要做两件事情,首先,在解除的目标视图控制器中写一个方法即
@IBAction func closeReviewVC(segue:UIStoryboardSegue){
dismiss(animated: true, completion: nil)
}
在界面控制器加入解除Segue之前,你至少必须在目标控制器要定义一个解除动作.这个动作方法告诉Xcode它可以解除.这里我们只是调用dismiss(animated:true,completion:nil)方法来解除,回到storyboard中,按住control键,并从close按钮拖拽至场景Dock上的Exit图示,按住出现的提示视窗,选择closeReviewVCWithSegue:作为动作Segue
执行项目可以看到效果
了解Outlet集合
@IBOutlet var rateButtons:[UIButton]!
设置love按钮的indentifier为love,剩下的两个按钮同理.