省钱达人老版本

UIView+LayoutMethods.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // UIView+LayoutMethods.h
  3. // TmallClient4iOS-Prime
  4. //
  5. // Created by casa on 14/12/8.
  6. // Copyright (c) 2014年 casa. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
  10. //#define SCREEN_WIDTH ([[UIScreen mainScreen]bounds].size.width)
  11. //#define SCREEN_HEIGHT ([[UIScreen mainScreen]bounds].size.height)
  12. #define SCREEN_WITHOUT_STATUS_HEIGHT (SCREEN_HEIGHT - [[UIApplication sharedApplication] statusBarFrame].size.height)
  13. @interface UIView (LayoutMethods)
  14. // coordinator getters
  15. - (CGFloat)height;
  16. - (CGFloat)width;
  17. - (CGFloat)x;
  18. - (CGFloat)y;
  19. - (CGSize)size;
  20. - (CGPoint)origin;
  21. - (CGFloat)centerX;
  22. - (CGFloat)centerY;
  23. - (CGFloat)bottom;
  24. - (CGFloat)right;
  25. - (void)setX:(CGFloat)x;
  26. - (void)setY:(CGFloat)y;
  27. // height
  28. - (void)setHeight:(CGFloat)height;
  29. - (void)heightEqualToView:(UIView *)view;
  30. // width
  31. - (void)setWidth:(CGFloat)width;
  32. - (void)widthEqualToView:(UIView *)view;
  33. // center
  34. - (void)setCenterX:(CGFloat)centerX;
  35. - (void)setCenterY:(CGFloat)centerY;
  36. - (void)centerXEqualToView:(UIView *)view;
  37. - (void)centerYEqualToView:(UIView *)view;
  38. // top, bottom, left, right
  39. - (void)top:(CGFloat)top FromView:(UIView *)view;
  40. - (void)bottom:(CGFloat)bottom FromView:(UIView *)view;
  41. - (void)left:(CGFloat)left FromView:(UIView *)view;
  42. - (void)right:(CGFloat)right FromView:(UIView *)view;
  43. - (void)topInContainer:(CGFloat)top shouldResize:(BOOL)shouldResize;
  44. - (void)bottomInContainer:(CGFloat)bottom shouldResize:(BOOL)shouldResize;
  45. - (void)leftInContainer:(CGFloat)left shouldResize:(BOOL)shouldResize;
  46. - (void)rightInContainer:(CGFloat)right shouldResize:(BOOL)shouldResize;
  47. - (void)topEqualToView:(UIView *)view;
  48. - (void)bottomEqualToView:(UIView *)view;
  49. - (void)leftEqualToView:(UIView *)view;
  50. - (void)rightEqualToView:(UIView *)view;
  51. // size
  52. - (void)setSize:(CGSize)size;
  53. - (void)sizeEqualToView:(UIView *)view;
  54. // imbueset
  55. - (void)fillWidth;
  56. - (void)fillHeight;
  57. - (void)fill;
  58. - (UIView *)topSuperView;
  59. /**
  60. * Removes all subviews.
  61. */
  62. - (void)removeAllSubviews;
  63. @end
  64. @protocol LayoutProtocol
  65. @required
  66. // put your layout code here
  67. - (void)calculateLayout;
  68. @end