簡體   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