123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- //
- // UIView+TXFrame.m
- // TXSwipeTableViewTest
- //
- // Created by tingxins on 9/1/16.
- // Copyright © 2016 tingxins. All rights reserved.
- //
- #import "UIView+TXFrame.h"
- @implementation UIView (TXFrame)
- - (CGFloat)tx_x {
- return self.frame.origin.x;
- }
- - (void)setTx_x:(CGFloat)tx_x {
- CGRect frame = self.frame;
- frame.origin.x = tx_x;
- self.frame = frame;
- }
- - (CGFloat)tx_y {
- return self.frame.origin.y;
- }
- - (void)setTx_y:(CGFloat)tx_y {
- CGRect frame = self.frame;
- frame.origin.y = tx_y;
- self.frame = frame;
- }
- - (CGFloat)tx_width {
- return self.frame.size.width;
- }
- - (void)setTx_width:(CGFloat)tx_width {
- CGRect frame = self.frame;
- frame.size.width = tx_width;
- self.frame = frame;
- }
- - (CGFloat)tx_height {
- return self.frame.size.height;
- }
- - (void)setTx_height:(CGFloat)tx_height {
- CGRect frame = self.frame;
- frame.size.height = tx_height;
- self.frame = frame;
- }
- - (CGSize)tx_size {
- return self.frame.size;
- }
- - (void)setTx_size:(CGSize)tx_size {
- CGRect frame = self.frame;
- frame.size = tx_size;
- self.frame = frame;
- }
- - (CGPoint)tx_origin {
- return self.frame.origin;
- }
- - (void)setTx_origin:(CGPoint)tx_origin {
- CGRect frame = self.frame;
- frame.origin = tx_origin;
- self.frame = frame;
- }
- - (CGPoint)tx_center {
- return self.center;
- }
- - (void)setTx_center:(CGPoint)tx_center {
- self.center = tx_center;
- }
- - (CGFloat)tx_centerX {
- return self.center.x;
- }
- - (void)setTx_centerX:(CGFloat)tx_centerX {
- CGPoint center = self.center;
- center.x = tx_centerX;
- self.center = center;
- }
- - (CGFloat)tx_centerY {
- return self.center.y;
- }
- - (void)setTx_centerY:(CGFloat)tx_centerY {
- CGPoint center = self.center;
- center.y = tx_centerY;
- self.center = center;
- }
- - (CGFloat)tx_bottom {
- return CGRectGetMaxY(self.frame);
- }
- - (void)setTx_bottom:(CGFloat)tx_bottom {
- CGRect frame = self.frame;
- frame.origin.y = tx_bottom - frame.size.height;
- self.frame = frame;
- }
- @end
|