[英]Name of file stuck in Xcode
The weirdest thing is happening in Xcode. 最奇怪的事情发生在Xcode中。 I had a View Controller file, called SettingsViewController.
我有一个名为ControllersViewController的View Controller文件。 From SettingsViewController, I am trying to push GameViewController.
从SettingsViewController,我试图推GameViewController。 When I was making this file, I mistakenly named it ViewViewController instead of GameViewController (it was late :D).
当我制作这个文件时,我错误地将其命名为ViewViewController而不是GameViewController(后来:D)。 I set the class of the files' respective views in the identity tab in the storyboard file.
我在情节提要文件的“身份”选项卡中设置了文件各自视图的类。 Later, I tried to change the name of the file ViewViewController to GameViewController by right-clicking on it in the left column and clicking rename.
后来,我尝试通过右键单击左列中的文件并单击重命名来将文件ViewViewController的名称更改为GameViewController。 I went into the storyboard file, and changed the class of the game view.
我进入情节提要文件,并更改了游戏视图的类。 Now, I can import the GameViewController file into the SettingsViewController file by saying
现在,我可以将GameViewController文件导入SettingsViewController文件,方法是说
#import GameViewController.h
But the following line gives an error: 但是以下行给出了一个错误:
GameViewController *gvc = [[GameViewController alloc] init];
The error says unknown type name GameViewController: Did you mean ViewViewController?
该错误显示
unknown type name GameViewController: Did you mean ViewViewController?
Am I missing a change that needs to be made? 我是否缺少需要进行的更改? All I did was change the name of the file and change the class in the storyboard.
我所做的就是更改文件名并更改情节提要中的类。
As I was about to post this question, I realized the answer. 当我要发布此问题时,我意识到了答案。 I had to go into GameViewController.h and change the line
我必须进入GameViewController.h并更改行
@interface ViewViewController : UIViewController
to 至
@interface GameViewController : UIViewController
Then, in GameViewController.m, I had to change: 然后,在GameViewController.m中,我必须更改:
@interface ViewViewController ()
to 至
@interface GameViewController ()
and change 并改变
@implementation ViewViewController
to 至
@implementation GameViewController
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.