/* Erica Sadun, http://ericasadun.com iPhone Developer's Cookbook, 3.0 Edition BSD License, Use at your own risk */ #import CGPoint CGRectGetCenter(CGRect rect); CGRect CGRectMoveToCenter(CGRect rect, CGPoint center); @interface UIView (ViewFrameGeometry) //@property CGPoint origin; @property CGSize size; @property (readonly) CGPoint bottomLeft; @property (readonly) CGPoint bottomRight; @property (readonly) CGPoint topRight; @property CGFloat height; @property CGFloat width; @property CGFloat top; @property CGFloat left; @property CGFloat bottom; @property CGFloat right; @property CGFloat x; @property CGFloat y; @property CGFloat centerX; @property CGFloat centerY; - (void) moveBy: (CGPoint) delta; - (void) scaleBy: (CGFloat) scaleFactor; - (void) fitInSize: (CGSize) aSize; - (void) testFrame; - (void)setCornerFrame; - (void)setCornerRadius:(CGFloat)radius; - (void)setRoundCorner:(UIRectCorner)corner radius:(CGFloat)radius; //设置单独的边框 - (void)setBorderWithView:(UIView *)view top:(BOOL)top left:(BOOL)left bottom:(BOOL)bottom right:(BOOL)right borderColor:(UIColor *)color borderWidth:(CGFloat)width; /// 更新view的约束级别 - (void)updatePriority:(UILayoutPriority)priority; /// 移除所有子元素 - (void)removeAllSubviews; ///页面截个图 - (UIImage *)snapshotImage; ///判断当前view是否显示在Window上 - (BOOL)isShowingOnKeyWindow; ///通过类名找到子view - (UIView *)getSubViewWithClassName:(NSString *)className; @end /** * 圆角按钮设置 */ @interface UIButton(cornerBtn) - (void)setCornerFrame; @end