29,027
社区成员
发帖
与我相关
我的任务
分享
#import "AppDelegate+Map.h"
#import <objc/runtime.h>
static NSString *strKey = @"key";
@interface AppDelegate ()
@property (nonatomic,strong) NSString *str;
@end
@implementation AppDelegate (Map)
/**
setter方法
*/
- (void)setStr:(NSString *)str {
objc_setAssociatedObject(self, &strKey,str, OBJC_ASSOCIATION_COPY);
}
/**
getter方法
*/
- (NSString *)str {
return objc_getAssociatedObject(self, &strKey);
}
-(void)test{
self.str = @"test";
}
@end
#import "AppDelegate+Map.h"
#import "MapManger.h"
#import <objc/runtime.h>
@interface AppDelegate ()
@property (nonatomic,strong) MapManger *map;
@end
@implementation AppDelegate (Map)
-(void)test{
self.map = [[MapManger alloc] init];
}
@end