【发布时间】:2020-12-20 23:20:50
【问题描述】:
我想将下面的 .merchant 菜单选项链接到我为其进行 UI 设计的另一个视图控制器,非模态。我感觉它与 Subview 和连接我的 MerchantViewController 有关。我不想添加按钮,我想使用这些“案例”。非常感谢,第一次发帖。
此视频中提到了可能的 childviewcontroller 解决方案:https://youtu.be/vKh1b3ctCf4?t=556
func transitionToNew(_ menuType: MenuType) {
topView?.removeFromSuperview()
switch menuType {
case .profile:
let view = UIView()
view.backgroundColor = .yellow
view.frame = self.view.bounds
self.view.addSubview(view)
self.topView = view
case .camera:
let view = UIView()
view.backgroundColor = .blue
view.frame = self.view.bounds
self.view.addSubview(view)
self.topView = view
//I want .merchant to link to a MerchantViewController
case .merchant:
let view = UIView()
//view.backgroundColor = .blue
view.frame = self.view.bounds
self.view.addSubview(view)
self.topView = view
default:
break
【问题讨论】:
标签: swift button uiviewcontroller menu