简体   繁体   English

如何快速将元素添加到新的 UIViewController?

[英]How to add a element to a new UIViewController on swift?

i have been trying to insert a element into my new view controller when this happened:发生这种情况时,我一直试图将一个元素插入到我的新视图控制器中: 在此处输入图片说明

For those of you who had the image not load, it said Could not insert new action connection: Could not find any information for the class named ProfileViewController.对于那些没有加载图像的人,它说无法插入新的操作连接:找不到名为 ProfileViewController 的类的任何信息。 ProfileViewController is the name of the ViewController. ProfileViewController 是 ViewController 的名称。 Here is my code for the ViewController:这是我的 ViewController 代码:

import UIKit
class ProfileViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

It was a cocoa touch class with Firebase and Cocoapods.这是一个带有 Firebase 和 Cocoapods 的可可触摸类。 Here is main.storyboard:这是 main.storyboard: 在此处输入图片说明

Did you enter the name of your class ( ProfileViewController ) in the "Class" portion of your storyboard?您是否在故事板的“类”部分中输入了类的名称 ( ProfileViewController )? See the image for reference.请参阅图像以供参考。 (This is found on the right pane of Xcode) (这是在 Xcode 的右侧窗格中找到的)

Also, I do not see any IBOutlet/IBAction properties in your ViewController which are required for any connection between your storyboard and your code.此外,我在您的 ViewController 中没有看到任何 IBOutlet/IBAction 属性,这是您的故事板和代码之间的任何连接所必需的。

If the issue is that you're unable to add an IBOutlet/IBAction, then I would recommend cleaning your project (Product > Clean) and removing DerivedData, then trying again.如果问题是您无法添加 IBOutlet/IBAction,那么我建议您清理您的项目(产品 > 清理)并删除 DerivedData,然后重试。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM