UIView+DNImagePicker.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // UIView+DNImagePicker.m
  3. // JKImagePicker
  4. //
  5. // Created by DingXiao on 15/2/11.
  6. // Copyright (c) 2015年 Dennis. All rights reserved.
  7. //
  8. #import "UIView+DNImagePicker.h"
  9. @implementation UIView (DNImagePicker)
  10. - (CGFloat)left {
  11. return self.frame.origin.x;
  12. }
  13. - (void)setLeft:(CGFloat)x {
  14. CGRect frame = self.frame;
  15. frame.origin.x = x;
  16. self.frame = frame;
  17. }
  18. - (CGFloat)top {
  19. return self.frame.origin.y;
  20. }
  21. - (void)setTop:(CGFloat)y {
  22. CGRect frame = self.frame;
  23. frame.origin.y = y;
  24. self.frame = frame;
  25. }
  26. - (CGFloat)right {
  27. return self.frame.origin.x + self.frame.size.width;
  28. }
  29. - (void)setRight:(CGFloat)right {
  30. CGRect frame = self.frame;
  31. frame.origin.x = right - frame.size.width;
  32. self.frame = frame;
  33. }
  34. - (CGFloat)bottom {
  35. return self.frame.origin.y + self.frame.size.height;
  36. }
  37. - (void)setBottom:(CGFloat)bottom {
  38. CGRect frame = self.frame;
  39. frame.origin.y = bottom - frame.size.height;
  40. self.frame = frame;
  41. }
  42. - (CGFloat)centerX {
  43. return self.center.x;
  44. }
  45. - (void)setCenterX:(CGFloat)centerX {
  46. self.center = CGPointMake(centerX, self.center.y);
  47. }
  48. - (CGFloat)centerY {
  49. return self.center.y;
  50. }
  51. - (void)setCenterY:(CGFloat)centerY {
  52. self.center = CGPointMake(self.center.x, centerY);
  53. }
  54. - (CGFloat)width {
  55. return self.frame.size.width;
  56. }
  57. - (void)setWidth:(CGFloat)width {
  58. CGRect frame = self.frame;
  59. frame.size.width = width;
  60. self.frame = frame;
  61. }
  62. - (CGFloat)height {
  63. return self.frame.size.height;
  64. }
  65. - (void)setHeight:(CGFloat)height {
  66. CGRect frame = self.frame;
  67. frame.size.height = height;
  68. self.frame = frame;
  69. }
  70. - (CGPoint)origin {
  71. return self.frame.origin;
  72. }
  73. - (void)setOrigin:(CGPoint)origin {
  74. CGRect frame = self.frame;
  75. frame.origin = origin;
  76. self.frame = frame;
  77. }
  78. - (CGSize)size {
  79. return self.frame.size;
  80. }
  81. - (void)setSize:(CGSize)size {
  82. CGRect frame = self.frame;
  83. frame.size = size;
  84. self.frame = frame;
  85. }
  86. @end