UIView+LookinServer.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // UIView+LookinServer.h
  3. // LookinServer
  4. //
  5. // Created by Li Kai on 2019/3/19.
  6. // https://lookin.work
  7. //
  8. #import "LookinDefines.h"
  9. #import <UIKit/UIKit.h>
  10. @interface UIView (LookinServer)
  11. @property(nonatomic, weak) UIViewController *lks_hostViewController;
  12. /// 是否是 UITabBar 的 childrenView,如果是的话,则截图时需要强制使用 renderInContext: 的方式而非 drawViewHierarchyInRect:afterScreenUpdates: 否则在 iOS 13 上获取到的图像是空的不知道为什么
  13. @property(nonatomic, assign) BOOL lks_isChildrenViewOfTabBar;
  14. /// point 是相对于 receiver 自身的坐标系
  15. - (UIView *)lks_subviewAtPoint:(CGPoint)point preferredClasses:(NSArray<Class> *)preferredClasses;
  16. - (CGFloat)lks_bestWidth;
  17. - (CGFloat)lks_bestHeight;
  18. - (CGSize)lks_bestSize;
  19. @property(nonatomic, assign) float lks_horizontalContentHuggingPriority;
  20. @property(nonatomic, assign) float lks_verticalContentHuggingPriority;
  21. @property(nonatomic, assign) float lks_horizontalContentCompressionResistancePriority;
  22. @property(nonatomic, assign) float lks_verticalContentCompressionResistancePriority;
  23. /// 遍历全局的 view 并给他们设置 lks_involvedRawConstraints 属性
  24. + (void)lks_rebuildGlobalInvolvedRawConstraints;
  25. /// 该属性保存了牵扯到当前 view 的所有 constraints,包括那些没有生效的
  26. @property(nonatomic, strong) NSMutableArray<NSLayoutConstraint *> *lks_involvedRawConstraints;
  27. - (NSArray<NSDictionary<NSString *, id> *> *)lks_constraints;
  28. @end