UIView+Additions.m 916 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // UIView+Additions.m
  3. // kneet2
  4. //
  5. // Created by Jason Lee on 10/2/15.
  6. // Copyright © 2015 ntels. All rights reserved.
  7. //
  8. #import "UIView+Additions.h"
  9. @implementation UIView (Additions)
  10. - (CGFloat)x {
  11. return self.frame.origin.x;
  12. }
  13. - (void)setX:(CGFloat)x {
  14. CGRect selfRect = self.frame;
  15. selfRect.origin.x = x;
  16. self.frame = selfRect;
  17. }
  18. - (CGFloat)y {
  19. return self.frame.origin.y;
  20. }
  21. - (void)setY:(CGFloat)y {
  22. CGRect selfRect = self.frame;
  23. selfRect.origin.y = y;
  24. self.frame = selfRect;
  25. }
  26. - (CGFloat)width {
  27. return self.frame.size.width;
  28. }
  29. - (void)setWidth:(CGFloat)width {
  30. CGRect selfRect = self.frame;
  31. selfRect.size.width = width;
  32. self.frame = selfRect;
  33. }
  34. - (CGFloat)height {
  35. return self.frame.size.height;
  36. }
  37. - (void)setHeight:(CGFloat)height {
  38. CGRect selfRect = self.frame;
  39. selfRect.size.height = height;
  40. self.frame = selfRect;
  41. }
  42. @end