您可以使用单独的类共享数据
入住这Singleton class
MyManger.h
#import <foundation/Foundation.h>
@interface MyManager : NSObject {
NSMutableDictionary *_dict
}
@property (nonatomic, retain) NSMutableDictionary *dict;
+ (id)sharedManager;
@end
MyManger.m
#import "MyManager.h"
static MyManager *sharedMyManager = nil;
@implementation MyManager
@synthesize dict = _dict;
#pragma mark Singleton Methods
+ (id)sharedManager {
@synchronized(self) {
if(sharedMyManager == nil)
sharedMyManager = [[super allocWithZone:NULL] init];
}
return sharedMyManager;
}
- (id)init {
if (self = [super init]) {
dict = [[NSMutableDictionary alloc] init];
}
return self;
}
您可以访问你的词典与其他地方有这样的
[MyManager sharedManager].dict
UIMutableDictionary或的NSMutableDictionary ...... – Rajneesh071 2013-02-12 11:37:38
人的情况下,这是令人尴尬的。我想,我一直工作太多:) – 2013-02-12 11:46:40
哈哈...保持它的男人:) – Rajneesh071 2013-02-12 11:50:18