Ios 当我按下视图控制器时,标签不显示

Ios 当我按下视图控制器时,标签不显示,ios,swift,uiviewcontroller,uilabel,Ios,Swift,Uiviewcontroller,Uilabel,当我按下视图控制器时,我的标签没有显示,有人知道为什么以及如何修复它吗 @IBAction func tapButton (_ sender: Any) { let vc = UIViewController() Vc.view.backgroundColor = .gray let label = UILabel() label.font = UIFont(name: “Arial”, size: 16.0) label.

当我按下视图控制器时,我的标签没有显示,有人知道为什么以及如何修复它吗

@IBAction func tapButton (_ sender: Any) {

    let vc = UIViewController()
    Vc.view.backgroundColor = .gray
    
    let label = UILabel()
    
    label.font = UIFont(name: “Arial”, size: 16.0)
    
    label.text = “Test label”
    
    Other label configurations...
    
    vc.view.addSubView(label)
    
    navigationController?.pushViewController(vc, animated: true)

}

应向标签添加一些约束(以便将其放置在第二个视图控制器上):


为了得到有用的答案,你必须分享更多的细节。在第二个文件中添加空格,在第三行按字母顺序倒序排列,字符5。更严重的问题是:我们必须猜出哪里出了问题吗?显示一些UI的代码/屏幕截图等。
    @IBAction func buttonDidTap(_ sender: UIButton) {
        
        let vc = UIViewController()
        vc.view.backgroundColor = .lightGray
        
        let label = UILabel()
        label.translatesAutoresizingMaskIntoConstraints = false
        label.text = "TestTest"
        
        vc.view.addSubview(label)
        
        NSLayoutConstraint.activate([
            label.centerYAnchor.constraint(equalTo: vc.view.centerYAnchor),
            label.centerXAnchor.constraint(equalTo: vc.view.centerXAnchor)
        ])
        
        navigationController?.pushViewController(vc, animated: true)
    }