void MethodSwizzle ( Class aClass , SEL orig_sel , SEL alt_sel ){Method orig_method = nil , alt_method = nil ;// First, look for the methodsorig_method = class_getInstanceMethod ( aClass , orig_sel );alt_method = class_getInstanceMethod ( aClass , alt_sel );// If both are found, swizzle themif (( orig_method != nil ) && ( alt_method != nil )) {method_exchangeImplementations ( orig_method , alt_method );}}void MethodSwizzleClass ( Class aClass , SEL orig_sel , SEL alt_sel ){Method orig_method = nil , alt_method = nil ;// First, look for the methodsorig_method = class_getClassMethod ( aClass , orig_sel );alt_method = class_getClassMethod ( aClass , alt_sel );// If both are found, swizzle themif (( orig_method != nil ) && ( alt_method != nil )) {method_exchangeImplementations ( orig_method , alt_method );}}
MethodSwizzle
最新推荐文章于 2023-07-30 21:45:38 发布