From 1e56ac9d035986a1a5fd6f3fc94c5c543c986bd1 Mon Sep 17 00:00:00 2001 From: Denis Morozov Date: Sun, 18 Sep 2016 22:52:58 +0300 Subject: [PATCH] Squashed commit of the following: commit d7922c0bf5724c142270b9d21d2557b65d49b4a0 Author: Denis Morozov Date: Sun Sep 18 17:43:31 2016 +0300 Use CGRect functions to get properties values instead of direct reading commit 6340b26a046857b55521bf4e54136b7378da9e27 Author: Denis Morozov Date: Sun Sep 18 17:30:35 2016 +0300 Remove direct reading of width/height values without standardization --- FrameAccessor/ViewFrameAccessor.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/FrameAccessor/ViewFrameAccessor.m b/FrameAccessor/ViewFrameAccessor.m index 048163c..3615b66 100644 --- a/FrameAccessor/ViewFrameAccessor.m +++ b/FrameAccessor/ViewFrameAccessor.m @@ -42,7 +42,7 @@ - (void)setViewSize:(CGSize)newSize - (CGFloat)x { - return self.frame.origin.x; + return CGRectGetMinX(self.frame); } - (void)setX:(CGFloat)newX @@ -54,7 +54,7 @@ - (void)setX:(CGFloat)newX - (CGFloat)y { - return self.frame.origin.y; + return CGRectGetMinY(self.frame); } - (void)setY:(CGFloat)newY @@ -69,7 +69,7 @@ - (void)setY:(CGFloat)newY - (CGFloat)height { - return self.frame.size.height; + return CGRectGetHeight(self.frame); } - (void)setHeight:(CGFloat)newHeight @@ -81,7 +81,7 @@ - (void)setHeight:(CGFloat)newHeight - (CGFloat)width { - return self.frame.size.width; + return CGRectGetWidth(self.frame); } - (void)setWidth:(CGFloat)newWidth @@ -106,7 +106,7 @@ - (void)setLeft:(CGFloat)left - (CGFloat)right { - return self.frame.origin.x + self.frame.size.width; + return CGRectGetMaxX(self.frame); } - (void)setRight:(CGFloat)right @@ -126,7 +126,7 @@ - (void)setTop:(CGFloat)top - (CGFloat)bottom { - return self.frame.origin.y + self.frame.size.height; + return CGRectGetMaxY(self.frame); } - (void)setBottom:(CGFloat)bottom @@ -180,12 +180,12 @@ - (CGPoint)middlePoint - (CGFloat)middleX { - return self.width / 2; + return CGRectGetMidX(self.bounds); } - (CGFloat)middleY { - return self.height / 2; + return CGRectGetMidY(self.bounds); } @end \ No newline at end of file