UIScrollView+MJExtension.m 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. // UIScrollView+Extension.m
  4. // MJRefreshExample
  5. //
  6. // Created by MJ Lee on 14-5-28.
  7. // Copyright (c) 2014年 小码哥. All rights reserved.
  8. //
  9. #import "UIScrollView+MJExtension.h"
  10. #import <objc/runtime.h>
  11. @implementation UIScrollView (MJExtension)
  12. - (void)setMj_insetT:(CGFloat)mj_insetT
  13. {
  14. UIEdgeInsets inset = self.contentInset;
  15. inset.top = mj_insetT;
  16. self.contentInset = inset;
  17. }
  18. - (CGFloat)mj_insetT
  19. {
  20. return self.contentInset.top;
  21. }
  22. - (void)setMj_insetB:(CGFloat)mj_insetB
  23. {
  24. UIEdgeInsets inset = self.contentInset;
  25. inset.bottom = mj_insetB;
  26. self.contentInset = inset;
  27. }
  28. - (CGFloat)mj_insetB
  29. {
  30. return self.contentInset.bottom;
  31. }
  32. - (void)setMj_insetL:(CGFloat)mj_insetL
  33. {
  34. UIEdgeInsets inset = self.contentInset;
  35. inset.left = mj_insetL;
  36. self.contentInset = inset;
  37. }
  38. - (CGFloat)mj_insetL
  39. {
  40. return self.contentInset.left;
  41. }
  42. - (void)setMj_insetR:(CGFloat)mj_insetR
  43. {
  44. UIEdgeInsets inset = self.contentInset;
  45. inset.right = mj_insetR;
  46. self.contentInset = inset;
  47. }
  48. - (CGFloat)mj_insetR
  49. {
  50. return self.contentInset.right;
  51. }
  52. - (void)setMj_offsetX:(CGFloat)mj_offsetX
  53. {
  54. CGPoint offset = self.contentOffset;
  55. offset.x = mj_offsetX;
  56. self.contentOffset = offset;
  57. }
  58. - (CGFloat)mj_offsetX
  59. {
  60. return self.contentOffset.x;
  61. }
  62. - (void)setMj_offsetY:(CGFloat)mj_offsetY
  63. {
  64. CGPoint offset = self.contentOffset;
  65. offset.y = mj_offsetY;
  66. self.contentOffset = offset;
  67. }
  68. - (CGFloat)mj_offsetY
  69. {
  70. return self.contentOffset.y;
  71. }
  72. - (void)setMj_contentW:(CGFloat)mj_contentW
  73. {
  74. CGSize size = self.contentSize;
  75. size.width = mj_contentW;
  76. self.contentSize = size;
  77. }
  78. - (CGFloat)mj_contentW
  79. {
  80. return self.contentSize.width;
  81. }
  82. - (void)setMj_contentH:(CGFloat)mj_contentH
  83. {
  84. CGSize size = self.contentSize;
  85. size.height = mj_contentH;
  86. self.contentSize = size;
  87. }
  88. - (CGFloat)mj_contentH
  89. {
  90. return self.contentSize.height;
  91. }
  92. @end