在 Storyboard 中的视图之间切换 [英] Switching between views in a Storyboard

查看:48
本文介绍了在 Storyboard 中的视图之间切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

在顶部,您可以看到旧视图,如果您按住第二个视图的顶部并移至底部,第二个视图将消失.我希望第二个视图覆盖在第一个视图上.第一个视图有一个带有动作的按钮:

On the top, you can see the old view and if you hold the top of the second view and move to bottom the second view disappear. I would like the second view to be overlayed on the first one. First view has a button with an action:

@IBaction func test() {
    let vc = self.storyboard!.instantiateViewController(withIdentifier: "ccc")
    self.show( vc, sender: nil )
}

推荐答案

只需将 modalPresentationStyle 更改为 .fullScreen.

//1
let vc = self.storyboard!.instantiateViewController(withIdentifier: "ccc")

//2
vc.modalPresentationStyle = .fullScreen

//3
self.present(vc, animated: true, completion: nil)

这篇关于在 Storyboard 中的视图之间切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆