我对Objective C很陌生,所以请对我慢一点。
我已经像这样构建了我的视图:ViewController=>Root(View)=>Controls(View)。Root 是一个 Singleton,所以我可以随时获取我的应用程序的根元素。
当我添加#import "Root.h"
时,Controls.h
我遇到了解析问题。
#import <UIKit/UIKit.h>
#import "Root.h" // triggers the error
@interface Controls : UIView
@end
这是我的 Root.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "Controls.h"
#import "Content.h"
@interface Root : UIView
{
Controls *m_controls; // Parse error: Unknown type name "Controls"
}
+(Root*)getInstance;
@end
是什么原因造成的?怎么修?