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标识符。我从来没有尝试过把这样的东西放到我的应用程序委托中,我对这应该如何工作有点困惑。谢谢!