UIView+RecursiveDescription.m 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // UIView+RecursiveDescription.m
  3. // iOS-Categories (https://github.com/shaojiankui/iOS-Categories)
  4. //
  5. // Created by Jakey on 14/12/15.
  6. // Copyright (c) 2014年 www.skyfox.org. All rights reserved.
  7. //
  8. #import "UIView+RecursiveDescription.h"
  9. @implementation UIView (RecursiveDescription)
  10. #pragma clang diagnostic push
  11. #pragma clang diagnostic ignored "-Wundeclared-selector"
  12. /**
  13. * @brief 打印视图层级
  14. *
  15. * @return 打印视图层级字符串
  16. */
  17. -(NSString*)recursiveView
  18. {
  19. NSString *description = [NSString stringWithFormat:@"%s [Line %d] \r\r %@",
  20. __PRETTY_FUNCTION__, __LINE__,
  21. [self performSelector:@selector(recursiveDescription)]];
  22. return description;
  23. }
  24. /**
  25. * @brief 打印约束
  26. *
  27. * @return 打印约束字符串
  28. */
  29. -(NSString*)constraintsDescription{
  30. NSString *description = [NSString stringWithFormat:@"%s [Line %d] \r\r %@ \r\r",
  31. __PRETTY_FUNCTION__, __LINE__,
  32. [[self constraints] description]];
  33. return description;
  34. }
  35. /**
  36. * @brief 打印整个autolayout树的字符串
  37. *
  38. * @return 打印整个autolayout树的字符串
  39. */
  40. //-(NSString*)autolayoutTraceDescription{
  41. // NSString *description = [NSString stringWithFormat:@"%s [Line %d] \r\r %@",
  42. // __PRETTY_FUNCTION__, __LINE__,
  43. // [self performSelector:@selector(_autolayoutTrace)]];
  44. // return description;
  45. //}
  46. #pragma clang diagnostic pop
  47. @end