繁体   English   中英

卡在Xcode中的文件名

[英]Name of file stuck in Xcode

最奇怪的事情发生在Xcode中。 我有一个名为ControllersViewController的View Controller文件。 从SettingsViewController,我试图推GameViewController。 当我制作这个文件时,我错误地将其命名为ViewViewController而不是GameViewController(后来:D)。 我在情节提要文件的“身份”选项卡中设置了文件各自视图的类。 后来,我尝试通过右键单击左列中的文件并单击重命名来将文件ViewViewController的名称更改为GameViewController。 我进入情节提要文件,并更改了游戏视图的类。 现在,我可以将GameViewController文件导入SettingsViewController文件,方法是说

#import GameViewController.h

但是以下行给出了一个错误:

GameViewController *gvc = [[GameViewController alloc] init];

该错误显示unknown type name GameViewController: Did you mean ViewViewController?

我是否缺少需要进行的更改? 我所做的就是更改文件名并更改情节提要中的类。

当我要发布此问题时,我意识到了答案。 我必须进入GameViewController.h并更改行

@interface ViewViewController : UIViewController

@interface GameViewController : UIViewController

然后,在GameViewController.m中,我必须更改:

@interface ViewViewController ()

@interface GameViewController ()

并改变

@implementation ViewViewController

@implementation GameViewController

暂无
暂无

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

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