iOS自带调试工具,还可强大,给张gif体验一下
UIDebuggingInformationOverlay.gif代码如下:
UIViewController+Debugging.h
#import <UIKit/UIKit.h>
@interface UIViewController (Debugging)
- (void)showDebugger;
@end
UIViewController+Debugging.m
#import "UIViewController+Debugging.h"
@implementation UIViewController (Debugging)
- (void)showDebugger
{
#ifdef DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
id debugClass = NSClassFromString(@"UIDebuggingInformationOverlay");
[debugClass performSelector:NSSelectorFromString(@"prepareDebuggingOverlay")];
id debugOverlayInstance = [debugClass performSelector:NSSelectorFromString(@"overlay")];
[debugOverlayInstance performSelector:NSSelectorFromString(@"toggleVisibility")];
#pragma clang diagnostic pop
#endif
}
@end
PS:转Ryan Peterson,侵立删
网友评论