Everyone can go to my githup download https://github.com/simplyou/YJ-UIIView-/tree/master
When setting the size of the pro have no feeling very painful ah, here provides a set of classification, directly into the project, in the PCH contains the header file can solve your egg pain problem;
/***********************. h file ********************************
Uiview+yj.h
Created by lightning on 14-6-8.
Copyright (c) 2014 Wen Yanjun. All rights reserved.
This classification provides a quick way to solve the problem of setting a wide height in OC
#import <UIKit/UIKit.h>
@interface UIView (YJ)
@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;
@property (nonatomic, assign) CGFloat CenterX;
@property (nonatomic, assign) CGFloat centery;
@property (nonatomic, assign) cgfloat width;
@property (nonatomic, assign) cgfloat height;
@property (nonatomic, assign) cgsize size;
@end
/***************************** Ornate Split Line **********************
. m file **********************************
Uiview+yj.h
Created by lightning on 14-6-8.
Copyright (c) 2014 Wen Yanjun. All rights reserved.
This classification provides a quick way to solve the problem of setting a wide height in OC
#import "Uiview+yj.h"
@implementation UIView (YJ)
-(void) SetSize: (cgsize) size
{
CGRect frame = self.frame;
frame.size = size;
Self.frame = frame;
}
-(cgsize) size
{
return self.frame.size;
}
-(void) SetX: (cgfloat) x
{
CGRect frame = self.frame;
frame.origin.x = x;
Self.frame = frame;
}
-(CGFloat) x
{
return self.frame.origin.x;
}
-(void) Sety: (cgfloat) y
{
CGRect frame = self.frame;
FRAME.ORIGIN.Y = y;
Self.frame = frame;
}
-(CGFloat) y
{
return SELF.FRAME.ORIGIN.Y;
}
-(void) Setcenterx: (cgfloat) CenterX
{
Cgpoint Center = self.center;
center.x = CenterX;
Self.center = center;
}
-(CGFloat) CenterX
{
return self.center.x;
}
-(void) Setcentery: (cgfloat) CenterY
{
Cgpoint Center = self.center;
Center.y = CenterY;
Self.center = center;
}
-(CGFloat) centery
{
return self.center.y;
}
-(void) SetWidth: (cgfloat) width
{
CGRect frame = self.frame;
Frame.size.width = width;
Self.frame = frame;
}
-(CGFloat) width
{
return self.frame.size.width;
}
-(void) SetHeight: (cgfloat) height
{
CGRect frame = self.frame;
Frame.size.height = height;
Self.frame = frame;
}
-(cgfloat) Height
{
return self.frame.size.height;
}
@end