无法使用 Xcode 6 创建 iPhone xib 文件

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

Can not create an iPhone xib file with Xcode 6

xcodexcode6interface-builderxib

提问by csciXAV_12

The checkbox to create a .xib file in Xcode 6 seems to be disabled. I can not find any way to enable it again. Does anybody know if this is possible?

在 Xcode 6 中创建 .xib 文件的复选框似乎被禁用。我找不到任何方法可以再次启用它。有谁知道这是否可能?

采纳答案by Zigii Wong

FYI, you can create xib file by follow.

仅供参考,您可以按照以下步骤创建 xib 文件。

enter image description here

在此处输入图片说明

回答by Mike Akers

Make sure you didn't accidentally select the OS X Cocoa Class file type instead of iOS Cocoa Touch Class.

确保您没有意外选择 OS X Cocoa Class 文件类型而不是 iOS Cocoa Touch Class。

Incorrect:

不正确:

Screenshot of creating an OS X Cocoa Class

创建 OS X Cocoa 类的屏幕截图

Correct:

正确的:

Screenshot of creating an iOS Cocoa Touch Class

创建 iOS Cocoa Touch 类的屏幕截图

回答by Purushottam Padhya

Creating xib files in xcode 6 is,

在 xcode 6 中创建 xib 文件是,

First of all create empty project as, Go to-> File > New >Project, Then select IOS >Other > Empty then Next After that creating a xib file as, Go to->File >New> File then IOS > Cocoa Touch Class and then NEXT Then select Viewcontroller and check for the "Also create XIB file"Then Next

首先创建一个空项目as, Go to-> File > New > Project, 然后选择IOS >Other > Empty then Next 然后创建一个xib文件as, Go to->File >New> File 然后IOS > Cocoa Touch Class然后 NEXT 然后选择 Viewcontroller 并检查“Also create XIB file”然后 Next

This will create a empty project as well as xib file.

这将创建一个空项目以及 xib 文件。

回答by Jayprakash Dubey

I had encountered this problem. Below is fix for this :

我遇到过这个问题。以下是对此的修复:

  1. Right click on files present in Project Navigatorsection.
  2. Select New File.

    OR

    Select Filefrom list of tab present in Xcode

    Select New -> File

    OR

    Simply press cmd+N

  3. Choose template for your new file as iOSnot OS X, tvOS or watchOS.

  1. 右键单击Project Navigator部分中存在的文件。
  2. 选择New File

    或者

    File从 Xcode 中存在的选项卡列表中选择

    选择 New -> File

    或者

    只需按下 cmd+N

  3. 为您的新文件选择模板,而iOS不是 OS X、tvOS 或 watchOS。

Screenshot 1

截图 1

  1. Select Cocoa Touch Classand then press Next

  2. Enter Class nameand select subclassof it.

  3. Checkmark Also create XIB file.

  4. Select device type and Language and then click Next

  5. Click on Createand make sure that Targets is selected.

    Screenshot 2

  1. 选择Cocoa Touch Class然后按Next

  2. 输入Class name并选择subclass它。

  3. 复选标记Also create XIB file

  4. 选择设备类型和语言,然后单击下一步

  5. 单击Create并确保Targets is selected.

    截图 2