Skip to content

Instantly share code, notes, and snippets.

@rakuishi
Created January 17, 2015 00:14
Show Gist options
  • Save rakuishi/a893db316969da025ce6 to your computer and use it in GitHub Desktop.
Save rakuishi/a893db316969da025ce6 to your computer and use it in GitHub Desktop.
//
// UIView+EasyRectMake.m
//
// Created by OCHIISHI Koichiro on 2012/10/25.
//
//
#import "UIView+EasyRectMake.h"
@implementation UIView (EasyRectMake)
- (CGFloat)originX
{
return self.frame.origin.x;
}
- (void)setOriginX:(CGFloat)originX
{
self.frame = CGRectMake(originX, self.frame.origin.y, self.frame.size.width, self.frame.size.height);
}
- (CGFloat)originY
{
return self.frame.origin.y;
}
- (void)setOriginY:(CGFloat)originY
{
self.frame = CGRectMake(self.frame.origin.x, originY, self.frame.size.width, self.frame.size.height);
}
- (CGFloat)sizeWidth
{
return self.frame.size.width;
}
- (void)setSizeWidth:(CGFloat)sizeWidth
{
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, sizeWidth, self.frame.size.height);
}
- (CGFloat)sizeHeight
{
return self.frame.size.height;
}
- (void)setSizeHeight:(CGFloat)sizeHeight
{
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, sizeHeight);
}
@end
//
// UIView+EasyRectMake.h
//
// Created by OCHIISHI Koichiro on 2012/10/25.
//
//
#import <UIKit/UIKit.h>
@interface UIView (EasyRectMake)
@property (assign, nonatomic) CGFloat originX;
@property (assign, nonatomic) CGFloat originY;
@property (assign, nonatomic) CGFloat sizeWidth;
@property (assign, nonatomic) CGFloat sizeHeight;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment