我正在使用segue进行从ViewController B
到ViewController A
的过渡,同时我正在使用segue将数据从ViewController B
传递到ViewController A
。我已经构造了代码,其中用户将点击backbutton
并使用alert controller
执行SCLAlertView cocoapods
。在进入下一个ViewController
之前,它会提示,但是当我运行它时,segue会自动执行而不先检查条件,并且它不会执行
alert controller
。我的代码在下面供您参考。希望您能对此有所帮助,因为我是新手,我进行了研究,但似乎看不到适用于我的问题的解决方案。谢谢。
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showVCA" {
if let vc_A = segue.destination as? ViewControllerA {
vc_A.validPincode = validPincode
vc_A.participants = participants
vc_A.event = event
}
}
}
@IBAction func backbutton(_ sender: UIButton) {
let alert = SCLAlertView(appearance: confirmationAppearance)
_ = alert.addButton("Leave", action: {
self.dismiss(animated: true, completion: nil)
self.performSegue(withIdentifier: "showVCA", sender: sender)
})
_ = alert.addButton("Stay", action: { })
_ = alert.showError("Confirmation", subTitle: "Are you sure you want to leave this page?")
}
答案 0 :(得分:0)
一旦.carousel {
background-color: #ddd;
}
表示您已经执行代码以移至下一个ViewController,则应在<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<div id="carousel-1" class="carousel slide">
<div class="carousel-inner">
<div class="carousel-item active">
Slide 1
</div>
<div class="carousel-item">
Slide 2
</div>
<div class="carousel-item">
Slide 3
</div>
</div>
<a class="carousel-control-prev d-none" href="#carousel-1" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next d-none" href="#carousel-1" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
之前进行验证。
performSegue
答案 1 :(得分:0)