123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- //
- // UIView+LayoutMethods.h
- // TmallClient4iOS-Prime
- //
- // Created by casa on 14/12/8.
- // Copyright (c) 2014年 casa. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
- //#define SCREEN_WIDTH ([[UIScreen mainScreen]bounds].size.width)
- //#define SCREEN_HEIGHT ([[UIScreen mainScreen]bounds].size.height)
- #define SCREEN_WITHOUT_STATUS_HEIGHT (SCREEN_HEIGHT - [[UIApplication sharedApplication] statusBarFrame].size.height)
- @interface UIView (LayoutMethods)
- // coordinator getters
- - (CGFloat)height;
- - (CGFloat)width;
- - (CGFloat)x;
- - (CGFloat)y;
- - (CGSize)size;
- - (CGPoint)origin;
- - (CGFloat)centerX;
- - (CGFloat)centerY;
- - (CGFloat)bottom;
- - (CGFloat)right;
- - (void)setX:(CGFloat)x;
- - (void)setY:(CGFloat)y;
- // height
- - (void)setHeight:(CGFloat)height;
- - (void)heightEqualToView:(UIView *)view;
- // width
- - (void)setWidth:(CGFloat)width;
- - (void)widthEqualToView:(UIView *)view;
- // center
- - (void)setCenterX:(CGFloat)centerX;
- - (void)setCenterY:(CGFloat)centerY;
- - (void)centerXEqualToView:(UIView *)view;
- - (void)centerYEqualToView:(UIView *)view;
- // top, bottom, left, right
- - (void)top:(CGFloat)top FromView:(UIView *)view;
- - (void)bottom:(CGFloat)bottom FromView:(UIView *)view;
- - (void)left:(CGFloat)left FromView:(UIView *)view;
- - (void)right:(CGFloat)right FromView:(UIView *)view;
- - (void)topInContainer:(CGFloat)top shouldResize:(BOOL)shouldResize;
- - (void)bottomInContainer:(CGFloat)bottom shouldResize:(BOOL)shouldResize;
- - (void)leftInContainer:(CGFloat)left shouldResize:(BOOL)shouldResize;
- - (void)rightInContainer:(CGFloat)right shouldResize:(BOOL)shouldResize;
- - (void)topEqualToView:(UIView *)view;
- - (void)bottomEqualToView:(UIView *)view;
- - (void)leftEqualToView:(UIView *)view;
- - (void)rightEqualToView:(UIView *)view;
- // size
- - (void)setSize:(CGSize)size;
- - (void)sizeEqualToView:(UIView *)view;
- // imbueset
- - (void)fillWidth;
- - (void)fillHeight;
- - (void)fill;
- - (UIView *)topSuperView;
- /**
- * Removes all subviews.
- */
- - (void)removeAllSubviews;
- @end
- @protocol LayoutProtocol
- @required
- // put your layout code here
- - (void)calculateLayout;
- @end
|