急急急

、、、

+(void)load

{

staticdispatch_once_tonce_token;

dispatch_once(&once_token, ^{

[objc_getClass("__NSDictionaryM")MethodExchangeWithOriginMethod:@selector(objectForKey:)andSwizzlingMethod:@selector(sw_objectForKey:)andIsInstanceMethod:YES];

[objc_getClass("__NSDictionaryM")MethodExchangeWithOriginMethod:@selector(removeObjectForKey:)andSwizzlingMethod:@selector(sw_removeObjectForKey:)andIsInstanceMethod:YES];

[objc_getClass("__NSDictionaryM")MethodExchangeWithOriginMethod:@selector(setObject:forKey:)andSwizzlingMethod:@selector(sw_setObject:forKey:)andIsInstanceMethod:YES];

});

}

- (id)sw_objectForKey:(id)aKey

{

if(aKey ==nil) {

returnnil;

}

return[selfsw_objectForKey:aKey];

}

- (void)sw_removeObjectForKey:(id)aKey

{

if(aKey ==nil) {

return;

}

[selfsw_removeObjectForKey:aKey];

}

- (void)sw_setObject:(id)anObject forKey:(id)aKey

{

if(anObject ==nil|| aKey ==nil) {

return;

}

[selfsw_setObject:anObjectforKey:aKey];

}

、、、

你可能感兴趣的:(急急急)