0
我想聲明另一個窗口MyThing.m無法聲明另一個窗口
@property (nonatomic, strong) UIWindow *window;
但得到這個錯誤
的財產非法重聲明類擴展 「MyThing」(屬性必須是「讀寫」,而其主要 必須是「只讀」)
如果我重新命名窗口到別的東西,它是好。這是爲什麼?窗口意味着在AppDelegate.h中聲明一次?
我想聲明另一個窗口MyThing.m無法聲明另一個窗口
@property (nonatomic, strong) UIWindow *window;
但得到這個錯誤
的財產非法重聲明類擴展 「MyThing」(屬性必須是「讀寫」,而其主要 必須是「只讀」)
如果我重新命名窗口到別的東西,它是好。這是爲什麼?窗口意味着在AppDelegate.h中聲明一次?
我想不通的問題,它沒有任何關係在AppDelegate.h聲明的窗口屬性
的問題是MyThing符合UIApplicationDelegate和UIApplicationDelegate協議聲明屬性
@property (nonatomic, retain) UIWindow *window NS_AVAILABLE_IOS(5_0);
所以我們必須做的這兩種
MyThing.h的(如AppDelegate.h一樣)
@interface MyThing : NSObject <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;
@end
OR
MyThing.m(合成在協議中聲明的窗口屬性)
@implementation WYNAppDelegate
@synthesize window;
@end
你已經有一個名爲'window'財產。你不能添加第二個。 – rmaddy
@rmaddy但窗口是在AppDelegate.h中聲明的,而這裏我在MyViewController.m中聲明,這是不是也可以接受? – onmyway133
顯示兩個聲明。 – rmaddy