我是swift和ios编程的新手.我正在尝试在我的应用程序首次加载时显示模态视图.我遇到的问题是我的模态一直在反复出现.不知道我哪里出错了.
奖金问题:最终我希望这只会在用户第一次打开应用时发生.
class ViewController: UIViewController {
var introModalDidDisplay = false
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
showIntroModal()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func showIntroModal() {
if (!introModalDidDisplay) {
println(introModalDidDisplay)
introModalDidDisplay = true
let intro = self.storyboard?.instantiateViewControllerWithIdentifier("introModal") as IntroModalViewController
intro.modalPresentationStyle = UIModalPresentationStyle.FormSheet
self.presentViewController(intro, animated: true, completion: nil)
}
}
}
Run Code Online (Sandbox Code Playgroud) 这个让我发疯.我主页上的内容部分返回404,"哎呀我们的坏......".我已经尝试了我能找到的一切,但没有任何效果.我已经尝试了单店模式错误的所有步骤.这没有解决它.我的"默认网址"设置为cms,我的主页被选为"CMS主页".如果我直接浏览CMS页面它可以正常工作,但是当我查看我的主页时,我得到了404 ....
我正在运行Magento 2.1.11版.