UIView+MJExtension.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // 代码地址: https://github.com/CoderMJLee/MJRefresh
  2. // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
  3. // UIView+Extension.m
  4. // MJRefreshExample
  5. //
  6. // Created by MJ Lee on 14-5-28.
  7. // Copyright (c) 2014年 小码哥. All rights reserved.
  8. //
  9. #import "UIView+MJExtension.h"
  10. @implementation UIView (MJExtension)
  11. - (void)setMj_x:(CGFloat)mj_x
  12. {
  13. CGRect frame = self.frame;
  14. frame.origin.x = mj_x;
  15. self.frame = frame;
  16. }
  17. - (CGFloat)mj_x
  18. {
  19. return self.frame.origin.x;
  20. }
  21. - (void)setMj_y:(CGFloat)mj_y
  22. {
  23. CGRect frame = self.frame;
  24. frame.origin.y = mj_y;
  25. self.frame = frame;
  26. }
  27. - (CGFloat)mj_y
  28. {
  29. return self.frame.origin.y;
  30. }
  31. - (void)setMj_w:(CGFloat)mj_w
  32. {
  33. CGRect frame = self.frame;
  34. frame.size.width = mj_w;
  35. self.frame = frame;
  36. }
  37. - (CGFloat)mj_w
  38. {
  39. return self.frame.size.width;
  40. }
  41. - (void)setMj_h:(CGFloat)mj_h
  42. {
  43. CGRect frame = self.frame;
  44. frame.size.height = mj_h;
  45. self.frame = frame;
  46. }
  47. - (CGFloat)mj_h
  48. {
  49. return self.frame.size.height;
  50. }
  51. - (void)setMj_size:(CGSize)mj_size
  52. {
  53. CGRect frame = self.frame;
  54. frame.size = mj_size;
  55. self.frame = frame;
  56. }
  57. - (CGSize)mj_size
  58. {
  59. return self.frame.size;
  60. }
  61. - (void)setMj_origin:(CGPoint)mj_origin
  62. {
  63. CGRect frame = self.frame;
  64. frame.origin = mj_origin;
  65. self.frame = frame;
  66. }
  67. - (CGPoint)mj_origin
  68. {
  69. return self.frame.origin;
  70. }
  71. @end