Няма описание

IQUIView+Hierarchy.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //
  2. // UIView+Hierarchy.h
  3. // https://github.com/hackiftekhar/IQKeyboardManager
  4. // Copyright (c) 2013-15 Iftekhar Qurashi.
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining a copy
  7. // of this software and associated documentation files (the "Software"), to deal
  8. // in the Software without restriction, including without limitation the rights
  9. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. // copies of the Software, and to permit persons to whom the Software is
  11. // furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Software.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. // THE SOFTWARE.
  23. #import <UIKit/UIView.h>
  24. #import "IQKeyboardManagerConstants.h"
  25. @class UICollectionView, UIScrollView, UITableView, NSArray;
  26. /**
  27. UIView hierarchy category.
  28. */
  29. @interface UIView (IQ_UIView_Hierarchy)
  30. ///------------------------------
  31. /// @name canBecomeFirstResponder
  32. ///------------------------------
  33. /**
  34. Returns YES if IQKeyboardManager asking for `canBecomeFirstResponder. Useful when doing custom work in `textFieldShouldBeginEditing:` delegate.
  35. */
  36. @property (nonatomic, readonly) BOOL isAskingCanBecomeFirstResponder;
  37. ///----------------------
  38. /// @name viewControllers
  39. ///----------------------
  40. /**
  41. Returns the UIViewController object that manages the receiver.
  42. */
  43. @property (nullable, nonatomic, readonly, strong) UIViewController *viewController;
  44. /**
  45. Returns the topMost UIViewController object in hierarchy.
  46. */
  47. @property (nullable, nonatomic, readonly, strong) UIViewController *topMostController;
  48. ///-----------------------------------
  49. /// @name Superviews/Subviews/Siglings
  50. ///-----------------------------------
  51. /**
  52. Returns the superView of provided class type.
  53. */
  54. -(nullable UIView*)superviewOfClassType:(nonnull Class)classType;
  55. /**
  56. Returns all siblings of the receiver which canBecomeFirstResponder.
  57. */
  58. @property (nonnull, nonatomic, readonly, copy) NSArray *responderSiblings;
  59. /**
  60. Returns all deep subViews of the receiver which canBecomeFirstResponder.
  61. */
  62. @property (nonnull, nonatomic, readonly, copy) NSArray *deepResponderViews;
  63. ///-------------------------
  64. /// @name Special TextFields
  65. ///-------------------------
  66. /**
  67. Returns YES if the receiver object is UISearchBarTextField, otherwise return NO.
  68. */
  69. @property (nonatomic, getter=isSearchBarTextField, readonly) BOOL searchBarTextField;
  70. /**
  71. Returns YES if the receiver object is UIAlertSheetTextField, otherwise return NO.
  72. */
  73. @property (nonatomic, getter=isAlertViewTextField, readonly) BOOL alertViewTextField;
  74. ///----------------
  75. /// @name Transform
  76. ///----------------
  77. /**
  78. Returns current view transform with respect to the 'toView'.
  79. */
  80. -(CGAffineTransform)convertTransformToView:(nullable UIView*)toView;
  81. ///-----------------
  82. /// @name Hierarchy
  83. ///-----------------
  84. /**
  85. Returns a string that represent the information about it's subview's hierarchy. You can use this method to debug the subview's positions.
  86. */
  87. @property (nonnull, nonatomic, readonly, copy) NSString *subHierarchy;
  88. /**
  89. Returns an string that represent the information about it's upper hierarchy. You can use this method to debug the superview's positions.
  90. */
  91. @property (nonnull, nonatomic, readonly, copy) NSString *superHierarchy;
  92. /**
  93. Returns an string that represent the information about it's frame positions. You can use this method to debug self positions.
  94. */
  95. @property (nonnull, nonatomic, readonly, copy) NSString *debugHierarchy;
  96. @end
  97. /**
  98. NSObject category to used for logging purposes
  99. */
  100. @interface NSObject (IQ_Logging)
  101. /**
  102. Short description for logging purpose.
  103. */
  104. @property (nonnull, nonatomic, readonly, copy) NSString *_IQDescription;
  105. @end