0
參考這個SO問題的答案:Keeping track of changes in a UIView 我需要幫助設置NSMutableSet的全局方面。在我appdelegate.h文件我有這樣的:創建一個全局NSMutableSet
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
ViewController *viewController;
NSMutableSet *statesTouched;
}
,這在我的appdelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
statesTouched = [[NSMutableSet alloc]init];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
在我viewcontroller.h文件我加入的對象是這樣的:
[statesTouched addObject:touchedStateName];
但我得到一個未聲明的statesTouched標識符。我從來沒有嘗試過把這樣的東西放到我的應用程序委託中,我對這應該如何工作有點困惑。謝謝!