将 swift 文件添加到 xCode 中的新视图控制器?(简单) [英] Adding swift file to new view controller in xCode? (easy)

查看:50
本文介绍了将 swift 文件添加到 xCode 中的新视图控制器?(简单)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 xCode 6,我似乎无法弄清楚如何将新的 swift 文件添加到我在界面构建器中添加的新视图控制器中.

I'm just starting out in xCode 6, and I can't seem to figure out how to add a new swift-file to the new view controllers I add in the interface builder.

任何有关如何进行的提示将不胜感激.

Any tips on how to proceed would be appreciated.

推荐答案

  1. 添加一个新的 Cocoa Touch 类.从菜单中选择文件->新建->文件....为这个新类命名,例如ViewController2",并将 Subclass of: 下拉菜单设置为 UIViewController.将创建文件ViewController2.swift".
  1. Add a new Cocoa Touch class. Choose File->New->File... from the menu. Give this new class a name such as "ViewController2" and set the Subclass of: pop down to UIViewController. The file "ViewController2.swift" will be created.

  1. 在 Interface Builder 中单击您的新视图控制器.在 Identity Inspector(在 Xcode 右侧)中,将视图控制器的 自定义类 设置为ViewController2".
  1. Click on your new View Controller in Interface Builder. In the Identity Inspector (on the right in Xcode) set the Custom Class for the View Controller to "ViewController2".

这篇关于将 swift 文件添加到 xCode 中的新视图控制器?(简单)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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