快速定位所在ViewController

2016-10-20  本文已影响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];

}

上一篇下一篇

猜你喜欢

热点阅读