美文网首页
快速定位所在ViewController

快速定位所在ViewController

作者: 有一种再见叫青春 | 来源:发表于2016-10-20 09:14 被阅读6次

+(void)load

{

#ifdef DEBUG

MethodviewwillAppear=class_getInstanceMethod(self,@selector(viewWillAppear:));

MethodlogViewWillApear=class_getInstanceMethod(self,@selector(logViewWillAppear:));

method_exchangeImplementations(viewwillAppear, logViewWillApear);

#endif

}

-(void)logViewWillAppear:(BOOL)animated

{

NSString*classname =NSStringFromClass([selfclass]);

//过滤条件,指定打印条件

if([classnamehasPrefix:@""] ==NO) {

NSLog(@"%@ will appear",classname);

}

[selflogViewWillAppear:animated];

}

相关文章

网友评论

      本文标题:快速定位所在ViewController

      本文链接:https://www.haomeiwen.com/subject/otsgrttx.html