@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
1.给类目添加属性需要使用runtime关联
#import <Foundation/Foundation.h>
@interface NSURLRequest (AIFNetworkingMethods)
@property (nonatomic, copy) NSDictionary *requestParams;
@end
#import "NSURLRequest+AIFNetworkingMethods.h"
#import <objc/runtime.h>
static void *AIFNetworkingRequestParams;
@implementation NSURLRequest (AIFNetworkingMethods)
- (void)setRequestParams:(NSDictionary *)requestParams
{
objc_setAssociatedObject(self, &AIFNetworkingRequestParams, requestParams, OBJC_ASSOCIATION_COPY);
}
- (NSDictionary *)requestParams
{
return objc_getAssociatedObject(self, &AIFNetworkingRequestParams);
}
@end
时间: 2024-10-16 07:52:45