2014-01-29 21 views
1

Xcode中最奇怪的事情正在發生。我有一個名爲SettingsViewController的View Controller文件。從SettingsViewController,我試圖推動GameViewController。當我製作這個文件時,我錯誤地將它命名爲ViewViewController而不是GameViewController(它遲到了:D)。我在故事板文件的標識選項卡中設置文件相應視圖的類。後來,我試圖通過在左列中右鍵單擊並將其更名爲GameViewController並單擊重命名來更改文件ViewViewController的名稱。我進入了故事板文件,並更改了遊戲視圖的類。現在,我可以說Xcode中的文件名稱

#import GameViewController.h 

導入GameViewController文件到SettingsViewController文件,但下面這行給出了一個錯誤:

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

錯誤說unknown type name GameViewController: Did you mean ViewViewController?

我缺少這一變化需要製作?我所做的只是更改文件的名稱並更改故事板中的類。

回答

1

當我正要發佈這個問題時,我意識到了答案。我不得不進入GameViewController.h和改線

@interface ViewViewController : UIViewController 

@interface GameViewController : UIViewController 

然後,在GameViewController.m,我不得不改變:

@interface ViewViewController() 

@interface GameViewController() 

and change

@implementation ViewViewController 

@implementation GameViewController