告别恶心的CGRect设置

FrameAccessor

https://github.com/AlexDenisov/FrameAccessor

 

Manual Install(手动安装)

All you need to do is drop FrameAccessor files into your project, and add #include "FrameAccessor.h" to the top of files that will use it.

你需要做的就是把文件夹FrameAccessor拖到你的工程当中,然后引入头文件FrameAccessor.h即可.

Example Usage

以前你要这么做才能设置frame值,看起来真傻缺!!

CGRect newFrame = view.frame;
newFrame.origin.x = 15.;
newFrame.size.width = 167.;
view.frame = newFrame;

现在你只需要这样子做就行了.

view.x = 15.;
view.width = 167.;

一切尽在不言中......

原文地址:https://www.cnblogs.com/YouXianMing/p/3656243.html