我有ForceGaugeViewController class和ForceGaugeController class。我試圖讓ForceGaugeController類成爲ForceGaugeViewController的一個子類,但是我收到了錯誤。實現類:找不到超類
錯誤:
Cannot find interface declaration for ForceGaugeViewController superclass of ForceGaugeController class.
ForceGaugeViewController.h
#import <UIKit/UIKit.h>
#import <math.h>
#import "HardwareController.h"
#import "ForceGaugeController.h"
@interface ForceGaugeViewController : UIViewController{
}
end
ForceGaugeViewController.m
#import "ForceGaugeViewController.h"
@implementation ForceGaugeViewController
ForceGaugeController.h
#import <Foundation/Foundation.h>
#import "ForceGaugeViewController.h"
#import "FMDatabase.h"
#import "FMResultSet.h"
@class ForceGaugeViewController;
// error here
@interface ForceGaugeController : ForceGaugeViewController{
}
@end
ForceGaugeController.m
#import "ForceGaugeController.h"
爲什麼你會' #import「ForceGaugeController.h」到'ForceGaugeController.h'中? – Mundi
您不能只轉發聲明您將繼承的類或您將實現的協議。這兩種做法都不違法(雖然風格不好)。 –
@Joe謝謝。我沒有注意到我在超類頭文件中有子類。有效。 – ilaunchpad