我對目標c很陌生,並且遇到一些基本問題。目標c中的未知類型名稱
我用導航器寫了一個簡單的程序,一切正常。 然後我添加了幾行代碼(甚至不記得是什麼,它似乎沒有連接到問題),並出現問題。我試着CTRL + Z和問題還存在:
我運行該程序,並得到這些錯誤:
1. unknown type name "mainController"
2. property with 'retain (or strong)' attribute must be of object type
而mainController要加載的第一個屏幕。
這是appDelegate.h文件:
#import <UIKit/UIKit.h>
#import "mainController.h"
#import "WishesList.h"
#import "Wish.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) IBOutlet UINavigationController *navController;
@property (strong, nonatomic) IBOutlet mainController *viewController; // this line creates the errors
@property (strong, nonatomic) WishesList *WishesArray;
@property (strong, nonatomic) NSIndexPath *temp;
@end
這是appDelegate.m文件的相關部分:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
WishesArray = [[WishesList alloc]init];
temp = nil;
[self setViewController:[[mainController alloc]init]];
[self setNavController:[[UINavigationController alloc]initWithRootViewController:self.viewController]];
[self.window setRootViewController:navController];
[self.window makeKeyAndVisible];
return YES;
}
這是mainController.h:
#import <UIKit/UIKit.h>
#import "addWishController.h"
#import "displayWish.h"
#import "WishesList.h"
#import "Wish.h"
@interface mainController : UIViewController
@property (nonatomic, weak) WishesList *list;
@property (nonatomic, strong) IBOutlet UITableView *wishTable;
- (void)addWish;
@end
它已經工作...
你能想出它嗎?
感謝
顯示美國'mainController。請。 – mattjgalloway 2012-01-10 09:59:43
是否有名稱爲'mainController'的類定義? – 2012-01-10 10:01:22
我加mainController.h所以你可以看到它也 – 2012-01-10 10:26:07