#ifdef DEBUG #import <UIKit/UIKit.h> #import <objc/runtime.h> @implementation UIView (FixViewDebugging) + (void)load { Method original = class_getInstanceMethod(self, @selector(viewForBaselineLayout)); class_addMethod(self, @selector(viewForFirstBaselineLayout), method_getImplementation(original), method_getTypeEncoding(original)); class_addMethod(self, @selector(viewForLastBaselineLayout), method_getImplementation(original), method_getTypeEncoding(original)); } @end #endif
参考链接:
http://stackoverflow.com/questions/36313850/debug-view-hierarchy-in-xcode-7-3-fails