format OC code

This commit is contained in:
pengfei.zhou
2019-10-12 14:48:19 +08:00
parent 820f1e9f8c
commit f9b599e7cf
43 changed files with 493 additions and 472 deletions

View File

@@ -8,12 +8,12 @@
#import "UIView+Doric.h"
@implementation UIView(Doric)
@implementation UIView (Doric)
- (CGFloat)x {
return self.frame.origin.x;
}
- (void)setX:(CGFloat)x {
CGRect frame = self.frame;
frame.origin.x = x;
@@ -29,7 +29,7 @@ - (void)setY:(CGFloat)y {
frame.origin.y = y;
[self setFrame:frame];
}
- (CGFloat)left {
return self.frame.origin.x;
}
@@ -39,31 +39,31 @@ - (void)setLeft:(CGFloat)left {
frame.origin.x = left;
[self setFrame:frame];
}
- (CGFloat)right {
return self.frame.origin.x + self.frame.size.width;
}
- (void)setRight:(CGFloat)right {
CGRect frame = self.frame;
frame.origin.x = right - self.frame.size.width;
[self setFrame:frame];
}
- (CGFloat)top {
return self.frame.origin.y;
}
- (void)setTop:(CGFloat)top {
CGRect frame = self.frame;
frame.origin.y = top;
[self setFrame:frame];
}
- (CGFloat)bottom {
return self.frame.origin.y + self.frame.size.height;
}
- (void)setBottom:(CGFloat)bottom {
CGRect frame = self.frame;
frame.origin.y = bottom - self.frame.size.height;
@@ -73,7 +73,7 @@ - (void)setBottom:(CGFloat)bottom {
- (CGFloat)width {
return self.frame.size.width;
}
- (void)setWidth:(CGFloat)width {
CGRect frame = self.frame;
frame.size.width = width;
@@ -83,30 +83,30 @@ - (void)setWidth:(CGFloat)width {
- (CGFloat)height {
return self.frame.size.height;
}
- (void)setHeight:(CGFloat)height {
CGRect frame = self.frame;
frame.size.height = height;
self.frame = frame;
}
- (CGFloat)centerX {
return self.frame.origin.x + self.frame.size.width/2;
return self.frame.origin.x + self.frame.size.width / 2;
}
- (void)setCenterX:(CGFloat)centerX {
CGRect frame = self.frame;
frame.origin.x = centerX - self.frame.size.width/2;
frame.origin.x = centerX - self.frame.size.width / 2;
[self setFrame:frame];
}
- (CGFloat)centerY {
return self.frame.origin.y + self.frame.size.height/2;
return self.frame.origin.y + self.frame.size.height / 2;
}
- (void)setCenterY:(CGFloat)centerY {
CGRect frame = self.frame;
frame.origin.y = centerY - self.frame.size.height/2;
frame.origin.y = centerY - self.frame.size.height / 2;
[self setFrame:frame];
}