// NSString* nameClass = NSStringFromClass(MBProgressHUD.class);
// Class catMetal = objc_getMetaClass([nameClass UTF8String]);
// [catMetal aspect_hookSelector:@selector(showHUDAddedTo:animated:) withOptions:AspectPositionInstead usingBlock:^(id<AspectInfo> aspectInfo,UIView *view,BOOL bo){
// NSLog(@"%@ 对象的viewDidLoad调用了",aspectInfo.instance);
//
//
// int64_t delayInSeconds = 1.0;
//
// // 延迟的时间
// // 调用方法原来的实现.
//
// MBProgressHUD *processTouches;
// NSInvocation *invocation = aspectInfo.originalInvocation;
// [invocation setArgument:&view atIndex:2];
// [invocation setArgument:&bo atIndex:3];
// [invocation invoke];
// [invocation getReturnValue:&processTouches];
// if (processTouches) {
// //processTouches = pspdf_stylusShouldProcessTouches(touches, event);
// [invocation setReturnValue:&processTouches];
// }
//
// //[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(boom:) object:nil];
// [self performSelector:@selector(boom:) withObject:processTouches afterDelay:4];
//
// } error:NULL];
//
//
//
// unsigned int count;
// Method *methods = class_copyMethodList([MBProgressHUD class], &count);
// for (int i = 0; i < count; i++) {
// Method method = methods[i];
// SEL selector = method_getName(method);
// NSString *name = NSStringFromSelector(selector);
// NSLog(@"method_getName:%@",name);
// }
//
// unsigned int numIvars;
// Ivar *vars = class_copyIvarList([UITextView class], &numIvars);
// NSString *key=nil;
// for(int i = 0; i < numIvars; i++) {
//
// Ivar thisIvar = vars[i];
// key = [NSString stringWithUTF8String:ivar_getName(thisIvar)];
// NSLog(@"variable_name :%@", key);
// }
// free(vars);
runtime框架 Aspects 类方法使用
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 我们常常会听说 Objective-C 是一门动态语言,那么这个「动态」表现在哪呢?我想最主要的表现就是 Obje...
- 本文转载自:http://southpeak.github.io/2014/10/25/objective-c-r...