| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- //
- // UIView+Layout.h
- // CommonLibrary
- //
- // Created by Alexi Chen on 2/28/13.
- // Copyright (c) 2013 AlexiChen. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- typedef enum : NSUInteger {
- TZOscillatoryAnimationToBigger,
- TZOscillatoryAnimationToSmaller,
- } TZOscillatoryAnimationType;
- @interface UIView (Layout)
- @property (assign, nonatomic) CGFloat top;
- @property (assign, nonatomic) CGFloat bottom;
- @property (assign, nonatomic) CGFloat left;
- @property (assign, nonatomic) CGFloat right;
- @property (assign, nonatomic) CGFloat x;
- @property (assign, nonatomic) CGFloat y;
- @property (assign, nonatomic) CGPoint origin;
- @property (assign, nonatomic) CGFloat centerX;
- @property (assign, nonatomic) CGFloat centerY;
- @property (assign, nonatomic) CGFloat width;
- @property (assign, nonatomic) CGFloat height;
- @property (assign, nonatomic) CGSize size;
- @property (nonatomic) CGFloat tz_left; ///< Shortcut for frame.origin.x.
- @property (nonatomic) CGFloat tz_top; ///< Shortcut for frame.origin.y
- @property (nonatomic) CGFloat tz_right; ///< Shortcut for frame.origin.x + frame.size.width
- @property (nonatomic) CGFloat tz_bottom; ///< Shortcut for frame.origin.y + frame.size.height
- @property (nonatomic) CGFloat tz_width; ///< Shortcut for frame.size.width.
- @property (nonatomic) CGFloat tz_height; ///< Shortcut for frame.size.height.
- @property (nonatomic) CGFloat tz_centerX; ///< Shortcut for center.x
- @property (nonatomic) CGFloat tz_centerY; ///< Shortcut for center.y
- @property (nonatomic) CGPoint tz_origin; ///< Shortcut for frame.origin.
- @property (nonatomic) CGSize tz_size; ///< Shortcut for frame.size.
- + (void)showOscillatoryAnimationWithLayer:(CALayer *)layer type:(TZOscillatoryAnimationType)type;
- // 添加子控件
- - (void)addOwnViews;
- // 配置子控件参数
- - (void)configOwnViews;
- //- (void)configWith:(NSMutableDictionary *)jsonDic;
- // isAutoLayoutr返回YES时,使用此方法进行布局
- - (void)autoLayoutSubViews;
- // 是否使用自动布局
- - (BOOL)isAutoLayout;
- /**
- 外部通过此功能进行设置,只在布局时使用
- @param rect CGRect
- */
- - (void)setFrameAndLayout:(CGRect)rect;
- /**
- 对于一些自定义的UIView,在设置Frame后,如需要重新调整局的话
- 作为所以控修改其自身内部子控件的入口
- 所有的自定义View最好不要从initWithFrams里面进行设置其子View的frame,统一在些处进行设置
- */
- - (void)relayoutFrameOfSubViews;
- - (void)addBottomLine:(CGRect)rect;
- - (void)addBottomLine:(UIColor *)color inRect:(CGRect)rect;
- @end
- @interface UIView (ShakeAnimation)
- // 左右shake
- - (void)shake;
- - (instancetype)init;
- @end
|