ios Xcode 6 创建新的目标 C 类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26009639/
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-08-31 02:45:17  来源:igfitidea点击:

Xcode 6 creating new objective C Class

iosobjective-cxcode6

提问by Anon

Working on iOS7+8 with xcode6 and running into a weird issue...

使用 xcode6 在 iOS7+8 上工作并遇到一个奇怪的问题......

I created the first viewController and thats fine, now I created another and I am trying to set that new viewController to a new class....

我创建了第一个 viewController ,那很好,现在我创建了另一个,我试图将那个新的 viewController 设置为一个新类......

in xCode4 all I had to do was create new-->Objective C Class....but I don't see this option in xcode6. All I see is this swift stuff, but I want an objective C class!

在 xCode4 中,我所要做的就是创建 new-->Objective C Class ....但我在 xcode6 中没有看到这个选项。我所看到的只是这些快速的东西,但我想要一个客观的 C 类!

I see I can make a new objective c file, but that doesn't really help me. I want to create both the .h and .m files.

我看到我可以创建一个新的目标 c 文件,但这并没有真正帮助我。我想同时创建 .h 和 .m 文件。

Thanks in advance,

提前致谢,

回答by Peter Pei Guo

Create Cocoa touch file - that will generate both .h and .m, and you can choose either with or without a xibgenerated. Be sure to pick Objective-c as language - now it lets you pick either Objective-c or Swift.

创建 Cocoa touch 文件 - 这将生成 .h 和 .m,您可以选择xib生成或不生成。一定要选择 Objective-c 作为语言 - 现在它允许你选择 Objective-c 或 Swift。

回答by Alan Scarpa

I had this same issue yesterday. The solution is simple:

我昨天有同样的问题。解决方法很简单:

1) File > New

1)文件>新建

2) Under IOS, click "Source"

2)在IOS下,点击“来源”

3) Select "Cocoa Touch Class"

3)选择“Cocoa Touch Class”

And then create your Class as you used to in Xcode 4. Now you should see your .h and .m files.

然后像以前在 Xcode 4 中一样创建你的类。现在你应该看到你的 .h 和 .m 文件。

回答by Suraj K Thomas

File → New → File... or use ?N.

Select Coccoa Touch Class

文件→新建→文件...或使用?N。

选择 Cocoa Touch Class

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

回答by Ashu

New File -> select source under iOS-> select cocoa touch class ->click on Next Put the class name -> click on Next-> selectddestination folder and click on create. Two file will create with. m and. h

New File -> 在iOS下选择source -> 选择cocoa touch class -> 点击Next 输入类名 -> 点击Next -> 选择ddestination文件夹点击create。将创建两个文件。米和。H

It May helps you.

它可能会帮助你。