【OBJC类扩展之尺寸】UIView+Size
来源:互联网 发布:书同文古籍数据库 编辑:程序博客网 时间:2024/05/17 23:51
import
import “UIView+Size.h”
@implementation UIView (Size)
- (void)setSize:(CGSize)size;
{
CGPoint origin = [self frame].origin;
[self setFrame:CGRectMake(origin.x, origin.y, size.width, size.height)];
}
- (CGSize)size;
{
return [self frame].size;
}
- (CGFloat)left;
{
return CGRectGetMinX([self frame]);
}
- (void)setLeft:(CGFloat)x;
{
CGRect frame = [self frame];
frame.origin.x = x;
[self setFrame:frame];
}
- (CGFloat)top;
{
return CGRectGetMinY([self frame]);
}
- (void)setTop:(CGFloat)y;
{
CGRect frame = [self frame];
frame.origin.y = y;
[self setFrame:frame];
}
- (CGFloat)right;
{
return CGRectGetMaxX([self frame]);
}
- (void)setRight:(CGFloat)right;
{
CGRect frame = [self frame];
frame.origin.x = right - frame.size.width;
[self setFrame:frame];
}
- (CGFloat)bottom;
{
return CGRectGetMaxY([self frame]);
}
- (void)setBottom:(CGFloat)bottom;
{
CGRect frame = [self frame];
frame.origin.y = bottom - frame.size.height;
[self setFrame:frame];
}
- (CGFloat)centerX;
{
return [self center].x;
}
- (void)setCenterX:(CGFloat)centerX;
{
[self setCenter:CGPointMake(centerX, self.center.y)];
}
- (CGFloat)centerY;
{
return [self center].y;
}
- (void)setCenterY:(CGFloat)centerY;
{
[self setCenter:CGPointMake(self.center.x, centerY)];
}
- (CGFloat)width;
{
return CGRectGetWidth([self frame]);
}
- (void)setWidth:(CGFloat)width;
{
CGRect frame = [self frame];
frame.size.width = width;
[self setFrame:CGRectStandardize(frame)];
}
- (CGFloat)height;
{
return CGRectGetHeight([self frame]);
}
- (void)setHeight:(CGFloat)height;
{
CGRect frame = [self frame];
frame.size.height = height;
[self setFrame:CGRectStandardize(frame)];
}
@end
- 【OBJC类扩展之尺寸】UIView+Size
- 【OBJC类扩展之尺寸】UIView+Size
- 【OBJC类扩展之定位】
- 【OBJC类扩展之MD5加密】NSString+MD5
- 【OBJC类扩展之属性字典】NSObject+Property
- 【OBJC类扩展之属性字典】NSObject+Property
- UIView剖析之Draw、Size、Layout方法
- CSS3之背景尺寸Background-size
- Opencv的Size类-尺寸类
- UIView的类扩展,扩展CGRect
- CityEngine CGA语法之尺寸函数 s(scope size)
- UIView类的常用扩展<一>
- UIView Why limit max size
- CSS3background-size背景图片尺寸属性
- CSS3background-size背景图片尺寸属性
- IOS UIView自动调整尺寸
- IOS UIView自动调整尺寸
- IOS UIView自动调整尺寸
- scala console 用:paste 多行输入
- Android实战技巧:深入解析AsyncTask
- Jenkins权限配置失误后导致登录失败(Access Denied)的解决办法
- 好博文整理收藏
- map关联容器
- 【OBJC类扩展之尺寸】UIView+Size
- 用二进制文件处理学生成绩
- 第十四周上机实践项目1(2):排序函数模板(选择法排序)
- 获取到剩余内存
- C#定时执行程序
- 7. Reverse Integer
- java多线程爬虫实现
- 我们到底是不是产品经理
- 算法的时间和空间复杂度问题