가 어떻게 원형 # import를 사용할 수 있습니다 목표 - C에서 개체를 직접 입력 한 강력 목표 - C에서 개체를 입력 할강하게
나는 오디오 컨트롤러 클래스, 메뉴 클래스와 gameview이 수업.
는 응용 프로그램의 대표는 이러한 클래스를 설정하고 그래서 포인터를 할당합니다
메뉴 클래스는 gameview 클래스는 오디오 및 메뉴 클래스
I에 대한 참조가 오디오 및 gameview 클래스 의 인식 메뉴 클래스에서 gameview 클래스에 대한 참조를 위해 NSObject를 사용하고 있습니다. 이것은 메뉴 클래스가 gameview 클래스에 대한 참조를 가지며 #import gameview.h 선언을 가지고 있기 때문입니다. 순환 #import 코드가 컴파일되지 않습니다
제안 사항 :) 제발?
@interface MenuViewController : UIViewController {
NSObject *gameref; // weak type here to avoid include of gameview above
AudioController *audioref;
}
및 ...
#import "AudioController.h"
#import "MenuViewController.h"
@interface GameViewController : UIViewController {
MenuViewController *menuref;
AudioController *audioref;
}
정확한 오류 메시지는 무엇입니까? 또한 'id'는보다 일반적인 표준 유형입니다. 이 경우'id' 또는'NSObject * '를 사용하는 대신 jib가 제시하는대로해야합니다. – outis
메서드를 호출 할 때 gameviewcontroller 대신 NSObject로 gameref를 느슨하게 입력했기 때문에 컴파일러 경고 메시지가 나타났습니다 – PeanutPower