如何從調整的方法調用原始方法?如何從調整的方法調用原始方法?
最初的方法是替換代碼:
[[UIWindow class] jr_swizzleMethod:@selector(originalMethod) withMethod:@selector(swizzledMethod) error:nil];
上swizzledMethod
以下代碼使遞歸!
[self originalMethod];
如何解決這個問題?
我用下面的庫混寫:
// JRSwizzle.h semver:1.0
// Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com
// Some rights reserved: http://opensource.org/licenses/MIT
// https://github.com/rentzsch/jrswizzle
#import <Foundation/Foundation.h>
@interface NSObject (JRSwizzle)
+ (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_;
+ (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_;
@end
鏈接的問題:http://stackoverflow.com/questions/11504133/swizzling-and-super – Dmitry