這應該是一個簡單的問題 - 但我很難搞清楚。我試圖在一個對象上創建一個屬性,這樣在prepareForSegue期間,我可以告訴對象它的委託是什麼。我知道我可以通過協議來做到這一點,但我認爲這種情況下直接的做法是最簡單的。不幸的是,下面的代碼會導致一個編譯器錯誤:聲明委託屬性時出錯
#import <UIKit/UIKit.h>
#import "PlanningViewController.h"
@interface DepartmentViewController : UITableViewController
@property (nonatomic, weak) PlanningViewController *planningDelegate;
@end
當我鍵入財產申報時,Xcode識別PlanningViewController甚至顯示文本,我只是通過TAB。但編譯器卻抱怨道:
Unknown type name 'PlanningViewController': did you mean 'UISplitViewController'?
我在做什麼錯?
PlanningViewController.h看起來是這樣的:
#import <UIKit/UIKit.h>
#import "DepartmentViewController.h"
@interface PlanningViewController : UITableViewController
// Table cell connections
- (IBAction)addItemPressed:(id)sender;
@end
請顯示'PlanningViewController.h'的內容。 – trojanfoe 2012-03-19 13:39:42