Xcode 6:创建新的 Objective C 文件搞砸了?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25553735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:27:03  来源:igfitidea点击:

Xcode 6: create new Objective C file messed up?

iosobjective-cxcodexcode6

提问by Lumpy

I've got Xcode 6 beta 6and just wanted to add a new Class to my project.

我有Xcode 6 beta 6,只是想在我的项目中添加一个新类。

Now, it is File -> New File -> Objective-C File and I have to choose between Empty File, Category, Protocol and Extension. I just want to make a new class (say HelloWorld) which inherits from let's say NSObject.

现在,它是文件 -> 新文件 -> Objective-C 文件,我必须在空文件、类别、协议和扩展名之间进行选择。我只想创建一个新类(比如HelloWorld),它继承自NSObject.

Normally the Xcode creates the .mfile and auto-creates the .hfile, but now it has only created the .mfile, named NSObject_HelloWorld.m. No header file has been created and I don't want the naming scheme with Superclass_newClasseither.

通常 Xcode 创建.m文件并自动创建.h文件,但现在它只创建了.m名为NSObject_HelloWorld.m的文件。没有创建头文件,我也不想要Superclass_newClass的命名方案。

Did I miss something?

我错过了什么?

回答by holex

everything is the quite similar to what was before, but here is the procedure in Xcode6 beta6:

一切都与之前的非常相似,但这是Xcode6 beta6 中的过程:

#1

#1

choose the Newand File...or press ?Non keyboard:

选择NewFile...或 按下?N键盘上的:

new

新的



#2

#2

choose iOS, Sourcethen Cocoa Touch Class:

选择iOSSource然后Cocoa Touch Class

Cocoa Touch Class

可可触摸班



#3

#3

type the name of your new class (e.g. HelloWorldClass), it is a subset of the NSObject, and you need to choose the Languageas well:

输入新类的名称(例如HelloWorldClass),它是 的子集NSObject,您还需要选择语言

HelloWorldClass

你好世界类

#4

#4

after you saved the files, you can find them in the Project Navigatorlike I did:

保存文件后,您可以像我一样在项目导航器中找到它们:

Project Navigator

项目导航