【发布时间】:2019-11-21 18:13:02
【问题描述】:
我在从另一个ViewController 访问ContainerView 中的UIButton 时遇到问题。
如果用户点击button,SubView 应该出现在我的ViewController 内。我尝试在ViewController 文件中拖动button 以创建@IBAaction func tapped(),但这不起作用。
它只适用于ContainerView.swift 文件。但我不能在那里创建我的Subview...
希望您能解决我的问题,感谢您的每一个帮助!
import UIKit
class ContainerViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func addButtonTapped(_ sender: Any) {
print("add Button")
}
【问题讨论】:
-
您可以添加屏幕截图吗?这会有所帮助!
-
请放心。
-
更新了答案。
标签: ios swift uiviewcontroller uicontainerview