轻松访问视图的帧,并提供一种便捷的方式以编程方式布局 UIViews 以保持代码的可读性。
将文件库文件夹复制到您的项目文件夹中
添加 QuartzCore.Framework
导入头文件。
#import "UIView+UzysAddition.h"
self.view.x = 5;
self.view.y = 10;
self.view.width = 100;
self.view.height = 200;
self.view.origin = CGPointMake(10, 10);
self.view.size = CGSizeMake(100, 100);
[self.viewMoving centerHorizontallyInSuperview];
[self.viewMoving centerVerticallyInSuperview];
[self.viewMoving centerInSuperview];
[self.viewMoving alignToTopInSuperviewWithInset:220];
[self.viewMoving alignToBottomInSuperviewWithInset:220];
[self.viewMoving alignToLeftInSuperviewWithInset:220];
[self.viewMoving alignToRightInSuperviewWithInset:220];
[self.viewMoving alignToBottomOfView:self.viewBase offset:5 align:UZYS_ALIGN_ANCHORPOINT_CENTER];
[self.viewMoving alignToTopOfView:self.viewBase offset:5 align:UZYS_ALIGN_ANCHORPOINT_CENTER];
[self.viewMoving alignToLeftOfView:self.viewBase offset:5 valign:UZYS_VALIGN_ANCHORPOINT_MIDDLE];
[self.viewMoving alignToRightOfView:self.viewBase offset:5 valign:UZYS_VALIGN_ANCHORPOINT_MIDDLE];