UIView的头文件简要介绍

//
//   UIView.h
//   UIKit
//
//   Copyright (c) 2005-2012, Apple Inc. All rights reserved.
//


#import 基础框架入口
#import 触摸事件响应处理
#import 界面UIcolor, UIFont 定义 
#import 一些宏定义
#import 外观代理
#import 布局对象约束


typedef NS_ENUM(NSInteger, UIViewAnimationCurve) { //动画曲线
      UIViewAnimationCurveEase InOut,             // slow at beginning and end 缓慢开始,中间加速,然后减速到结束
      UIViewAnimationCurveEase In,                  // slow at beginning   缓慢开始,加速到结束
      UIViewAnimationCurveEase Out,                // slow at end   加速开始,加速到结束
      UIViewAnimationCurveLine ar   //正常速度
};


typedef NS_ENUM(NSInteger, UIViewContentMode) {
      UIViewContentModeScaleTo Fill,   缩放内容到合适比例大小
      UIViewContentModeScaleAs pectFit,         // contents scaled to fit with fixed aspect. remainder is transparent 缩放内容到合适的大小,边界多余部分透明
      UIViewContentModeScaleAs pectFill,       // contents scaled to fill with fixed aspect. some portion of content may be clipped.缩放内容填充到指定大小,边界多余的部分省略
      UIViewContentModeRedraw,                     // redraw on bounds change (calls -setNeedsDisplay) 重绘视图边界
      UIViewContentModeCenter,                     // contents remain same size. positioned adjusted.   视图保持等比缩放
      UIViewContentModeTop, 视图顶部对齐
      UIViewContentModeBottom, 视图底部对齐
      UIViewContentModeLeft, 视图左侧对齐
      UIViewContentModeRight, 视图右侧对齐
      UIViewContentModeTopLeft , 视图左上角对齐
      UIViewContentModeTopRigh t, 视图右上角对齐
      UIViewContentModeBottomL eft, 视图左下角对齐
      UIViewContentModeBottomR ight, 视图右下角对齐
};


typedef NS_ENUM(NSInteger, UIViewAnimationTransitio n) {
      UIViewAnimationTransitio nNone, 没有过渡
      UIViewAnimationTransitio nFlipFromLeft,   翻转视图从左到右
      UIViewAnimationTransitio nFlipFromRight, 翻转视图从右到左
      UIViewAnimationTransitio nCurlUp, 从上卷动
      UIViewAnimationTransitio nCurlDown, 从下卷动
};


typedef NS_OPTIONS(NSUInteger, UIViewAutoresizing) {
      UIViewAutoresizingNone                         = 0,   父视图变化,自己不变化
      UIViewAutoresizingFlexib leLeftMargin    = 1 << 0,   视图的左边界和父视图的宽度等比例变化
      UIViewAutoresizingFlexib leWidth            = 1 << 1,视图的宽度和父视图的宽度成比例变化
      UIViewAutoresizingFlexib leRightMargin   = 1 << 2, 视图的右边界和父视图的宽度等比例变化
      UIViewAutoresizingFlexib leTopMargin      = 1 << 3,   视图的上边界和父视图的高度成等比例变化
      UIViewAutoresizingFlexib leHeight          = 1 << 4,   视图的高度和父视图的高度成比例变化
      UIViewAutoresizingFlexib leBottomMargin = 1 << 5 视图的下边界和父视图的高度成等比例变化
};


typedef NS_OPTIONS(NSUInteger, UIViewAnimationOptions) {
      UIViewAnimationOptionLay outSubviews                  = 1 <<   0,
      UIViewAnimationOptionAll owUserInteraction         = 1 <<   1, // turn on user interaction while animating
      UIViewAnimationOptionBeg inFromCurrentState       = 1 <<   2, // start all views from current value, not initial value
      UIViewAnimationOptionRep eat                              = 1 <<   3, // repeat animation indefinitely
      UIViewAnimationOptionAut oreverse                      = 1 <<   4, // if repeat, run animation back and forth
      UIViewAnimationOptionOve rrideInheritedDuration = 1 <<   5, // ignore nested duration
      UIViewAnimationOptionOve rrideInheritedCurve      = 1 <<   6, // ignore nested curve
      UIViewAnimationOptionAll owAnimatedContent         = 1 <<   7, // animate contents (applies to transitions only)
      UIViewAnimationOptionSho wHideTransitionViews    = 1 <<   8, // flip to/from hidden state instead of adding/removing

      UIViewAnimationOptionCur veEaseInOut                  = 0 << 16, // default
      UIViewAnimationOptionCur veEaseIn                      = 1 << 16,
      UIViewAnimationOptionCur veEaseOut                     = 2 << 16,
      UIViewAnimationOptionCur veLinear                      = 3 << 16,

      UIViewAnimationOptionTra nsitionNone                  = 0 << 20, // default
      UIViewAnimationOptionTra nsitionFlipFromLeft      = 1 << 20,
      UIViewAnimationOptionTra nsitionFlipFromRight    = 2 << 20,
      UIViewAnimationOptionTra nsitionCurlUp               = 3 << 20,
      UIViewAnimationOptionTra nsitionCurlDown            = 4 << 20,
      UIViewAnimationOptionTra nsitionCrossDissolve    = 5 << 20,
      UIViewAnimationOptionTra nsitionFlipFromTop       = 6 << 20,
      UIViewAnimationOptionTra nsitionFlipFromBottom   = 7 << 20,
} NS_ENUM_AVAILABLE_IOS(4_0);


@class UIEvent, UIWindow, UIViewController, UIColor, UIGestureRecognizer, CALayer;


NS_CLASS_AVAILABLE_IOS(2_0) @interface UIView : UIResponder {
   @package
      CALayer            *_layer;
      id                     _tapInfo;
      id                     _gestureInfo;
      NSMutableArray *_gestureRecognizers;
      NSArray            *_subviewCache;
      float                _charge;
      NSInteger          _tag;
      UIViewController *_viewDelegate;
      NSString             *_backgroundColorSystemCol orName;
      struct {
            unsigned int userInteractionDisabled:1;
            unsigned int implementsDrawRect:1;
            unsigned int implementsDidScroll:1;
            unsigned int implementsMouseTracking:1;
            unsigned int hasBackgroundColor:1;
            unsigned int isOpaque:1;
            unsigned int becomeFirstResponderWhen Capable:1;
            unsigned int interceptMouseEvent:1;
            unsigned int deallocating:1;
            unsigned int debugFlash:1;
            unsigned int debugSkippedSetNeedsDisp lay:1;
            unsigned int debugScheduledDisplayIsR equired:1;
            unsigned int isInAWindow:1;
            unsigned int isAncestorOfFirstRespond er:1;
            unsigned int dontAutoresizeSubviews:1;
            unsigned int autoresizeMask:6;
            unsigned int patternBackground:1;
            unsigned int fixedBackgroundPattern:1;
            unsigned int dontAnimate:1;
            unsigned int superLayerIsView:1;
            unsigned int layerKitPatternDrawing:1;
            unsigned int multipleTouchEnabled:1;
            unsigned int exclusiveTouch:1;
            unsigned int hasViewController:1;
            unsigned int needsDidAppearOrDisappea r:1;
            unsigned int gesturesEnabled:1;
            unsigned int deliversTouchesForGestur esToSuperview:1;
            unsigned int chargeEnabled:1;
            unsigned int skipsSubviewEnumeration:1;
            unsigned int needsDisplayOnBoundsChan ge:1;
            unsigned int hasTiledLayer:1;
            unsigned int hasLargeContent:1;
            unsigned int unused:1;
            unsigned int traversalMark:1;
            unsigned int appearanceIsInvalid:1;
            unsigned int monitorsSubtree:1;
            unsigned int layoutEngineIsOverridden :1;
            unsigned int constraintsAreClean:1;
            unsigned int subviewLayoutConstraints AreClean:1;
            unsigned int potentiallyHasDanglyCons traints:1;
            unsigned int doesNotTranslateAutoresi zingMaskIntoConstraints:1;
            unsigned int autolayoutIsClean:1;
            unsigned int subviewsAutolayoutIsClea n:1;
            unsigned int layoutFlushingDisabled:1;
            unsigned int layingOutFromConstraints :1;
            unsigned int wantsAutolayout:1;
            unsigned int subviewWantsAutolayout:1;
            unsigned int isApplyingValuesFromEngi ne:1;
            unsigned int isInAutolayout:1;
            unsigned int isUpdatingAutoresizingCo nstraints:1;
            unsigned int isUpdatingConstraints:1;
            unsigned int stayHiddenAwaitingReuse:1;
            unsigned int stayHiddenAfterReuse:1;
            unsigned int skippedLayoutWhileHidden ForReuse:1;
      } _viewFlags;
}


+ (Class)layerClass;                                    // default is [CALayer class]. Used when creating the underlying layer for the view. 绘图布局


- (id)initWithFrame:(CGRect)frame;               // default initializer 初始化视图布局


@property(nonatomic,getter=isUserInteractionEnabled ) BOOL userInteractionEnabled;   // default is YES. if set to NO, user events (touch, keys) are ignored and removed from the event queue.确定是否接受用户事件
@property(nonatomic)                                                 NSInteger tag;                        // default is 0   标记视图对象
@property(nonatomic,readonly,retain)                         CALayer   *layer;                     // returns view's layer. Will always return a non-nil value. view is layer's delegate 返回一个只读的视图层


@end


@interface UIView(UIViewGeometry)


// animatable. do not use frame if view is transformed since it will not correctly reflect the actual location of the view. use bounds + center instead.
@property(nonatomic) CGRect                  frame;   描述view在其父view坐标系中的定位和大小


// use bounds/center and not frame if non-identity transform. if bounds dimension is odd, center may be have fractional part
@property(nonatomic) CGRect                  bounds;         // default bounds is zero origin, frame size. animatable 描述view自身的本地坐标系统的定位和大小
@property(nonatomic) CGPoint                center;         // center is center of frame. animatable 描述view的frame属性的中心点
@property(nonatomic) CGAffineTransform transform;    // default is CGAffineTransformIdentit y. animatable 描述view相对bounds的平移量
@property(nonatomic) CGFloat                contentScaleFactor NS_AVAILABLE_IOS(4_0); 改变视图比例,主要用于修改分辨率,来支持高,低分辨率转化绘图


@property(nonatomic,getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled;    // default is NO 设置是否接受多点触摸。YES 是接受多点,NO 接受单点。
@property(nonatomic,getter=isExclusiveTouch) BOOL          exclusiveTouch;             // default is NO 当前视图独占触摸事件


- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;    // recursively calls -pointInside:withEvent:. point is in the receiver's coordinate system   接收视图触摸事件,遍历视图,确定最终接受视图层
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;    // default returns YES if point is in bounds      判断触摸事件是否在当前视图


- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;   转化当前视图的坐标相对于另外一个视图的坐标
- (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view; 转化另外视图坐标相对于当前视图的坐标
- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view; 转化当前视图的矩形坐标相对于另外一个视图的矩形
- (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view;转化另外视图的矩形坐标相对于当前视图矩形


@property(nonatomic) BOOL                      autoresizesSubviews; // default is YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes 判断是否接收边界的改变,YES:接收   NO:不接收
@property(nonatomic) UIViewAutoresizing autoresizingMask;      // simple resize. default is UIViewAutoresizingNone   视图边界大小调整参数


- (CGSize)sizeThatFits:(CGSize)size;       // return 'best' size to fit given size. does not actually resize view. Default is return existing view size 计算并返回一个最适应接收子视图的大小    
- (void)sizeToFit;                                  // calls sizeThatFits: with current view bounds and changes bounds size. 移动并调整子视图的大小


@end


@interface UIView(UIViewHierarchy)


@property(nonatomic,readonly) UIView          *superview; 父视图
@property(nonatomic,readonly,copy) NSArray *subviews; 子视图
@property(nonatomic,readonly) UIWindow       *window; 窗口


- (void)removeFromSuperview;   将当前视图从父视图和窗口移除,并且把它的响应事件的响应链移除。
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;    指定索引插入视图
- (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2; 指定索引交换子视图

视图的添加都是以栈的方式,即后进先出。
- (void)addSubview:(UIView *)view;   添加视图到最后- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;添加视图到底层
- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview; 添加视图到顶层


- (void)bringSubviewToFront:(UIView *)view; 将指定子视图推送到前台(顶层)
- (void)sendSubviewToBack:(UIView *)view;   将指定子视图推送到后台


- (void)didAddSubview:(UIView *)subview;通知某个子视图已经添加
- (void)willRemoveSubview:(UIView *)subview;通知视图某个子视图即将移除


- (void)willMoveToSuperview:(UIView *)newSuperview; 通知即将移动到新的父视图中
- (void)didMoveToSuperview;通知已经到新父视图
- (void)willMoveToWindow:(UIWindow *)newWindow; 通知即将已移动到新的窗口
- (void)didMoveToWindow; 通知已经移动新的窗口


- (BOOL)isDescendantOfView:(UIView *)view;   // returns YES for self. 判断一个视图是否在父视图层中
- (UIView *)viewWithTag:(NSInteger)tag;       // recursive search. includes self   获取标记的子视图


// Allows you to perform layout before the drawing cycle happens. -layoutIfNeeded forces layout early
- (void)setNeedsLayout;   标记为需要重新布局,异步调用layoutIfNeeded刷新布局,不立即刷新,但layoutSubviews一定会被调用
- (void)layoutIfNeeded;如果,有需要刷新的标记,立即调用layoutSubviews进行布局(如果没有标记,不会调用layoutSubviews)


- (void)layoutSubviews;      // override point. called by layoutIfNeeded automatically. As of iOS 6.0, when constraints-based layout is used the base implementation applies the constraints-based layout, otherwise it does nothing. 重新布局


@end


@interface UIView(UIViewRendering)


- (void)drawRect:(CGRect)rect;   子类重写方法,重绘


- (void)setNeedsDisplay; 标记为需要重绘,异步调用drawRect
- (void)setNeedsDisplayInRect:(CGRect)rect; 标记为需要局部重绘


@property(nonatomic)                         BOOL                     clipsToBounds;                     // When YES, content and subviews are clipped to the bounds of the view. Default is NO. 决定子视图边界是否可以超过父视图范围
@property(nonatomic,copy)                  UIColor               *backgroundColor;                  // default is nil 背景颜色
@property(nonatomic)                         CGFloat                alpha;                                 // animatable. default is 1.0 透明度, 取值范围为0.0 --- 1.0                       
@property(nonatomic,getter=isOpaque) BOOL                     opaque;                               // default is YES. opaque views must fill their entire bounds or the results are undefined. the active CGContext in drawRect: will not have been cleared and may have non-zeroed pixels      决定该消息接收者(UIView instance)是否让其视图不透明,用处在于给绘图系统提供一个性能优化开关。
@property(nonatomic)                         BOOL                     clearsContextBeforeDrawi ng; // default is YES. ignored for opaque views. for non-opaque views causes the active CGContext in drawRect: to be pre-filled with transparent pixels       决定绘制前是否清屏,默认为YES
@property(nonatomic,getter=isHidden) BOOL                     hidden;                               // default is NO. doesn't check superviews    视图是否隐藏,默认为NO(显示),YES为隐藏
@property(nonatomic)                         UIViewContentMode contentMode;                        // default is UIViewContentModeScaleTo Fill 视图边界填充
@property(nonatomic)                         CGRect                  contentStretch NS_DEPRECATED_IOS(3_0,6_0); // animatable. default is unit rectangle {{0,0} {1,1}}. Now deprecated: please use -[UIImage resizableImageWithCapIns ets:] to achieve the same effect. 视图拉伸和缩略


@end


@interface UIView(UIViewAnimation)


+ (void)beginAnimations:(NSString *)animationID context:(void *)context;   // additional context info passed to will start/did stop selectors. begin/commit can be nested    开始一个动画
+ (void)commitAnimations;                                                                         // starts up any animations when the top level animation is commited 结束一个动画,类似数据库的事务处理


// no getters. if called outside animation block, these setters have no effect.
+ (void)setAnimationDelegate:(id)delegate;                                       // default = nil   设置动画委托
+ (void)setAnimationWillStartSel ector:(SEL)selector;                        // default = NULL. -animationWillStart:(NSString *)animationID context:(void *)context //当动画执行开始时,执行selector方法
+ (void)setAnimationDidStopSelec tor:(SEL)selector;                           // default = NULL. -animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context //当动画执行结束时,执行selector方法
+ (void)setAnimationDuration:(NSTimeInterval)duration;                     // default = 0.2   //设置动画时间, 时间参数为double类型
+ (void)setAnimationDelay:(NSTimeInterval)delay;                              // default = 0.0   //设置动画延迟时间,单位秒
+ (void)setAnimationStartDate:(NSDate *)startDate;                           // default = now ([NSDate date]) 设置在动画块内部动画属性改变的开始时间
+ (void)setAnimationCurve:(UIViewAnimationCurve)curve;                     // default = UIViewAnimationCurveEase InOut    设置动画的旋转曲度变化
+ (void)setAnimationRepeatCount:(float)repeatCount;                         // default = 0.0.   May be fractional 设置动画在动画模块中的重复次数                
+ (void)setAnimationRepeatAutore verses:(BOOL)repeatAutoreverses;      // default = NO. used if repeat count is non-zero   设置动画块中的动画效果是否自动重复播放
+ (void)setAnimationBeginsFromCu rrentState:(BOOL)fromCurrentState;   // default = NO. If YES, the current view position is always used for new animations -- allowing animations to "pile up" on each other. Otherwise, the last end state is used for the animation (the default). 设置动画是否从当前状态开始播放。


+ (void)setAnimationTransition:(UIViewAnimationTransitio n)transition forView:(UIView *)view cache:(BOOL)cache;   // current limitation - only one per begin/commit block   //在动画块设置过渡效果


+ (void)setAnimationsEnabled:(BOOL)enabled;                                     // ignore any attribute changes while set. 设置是否开启动画,默认YES,开启
+ (BOOL)areAnimationsEnabled; 验证动画是否开启,YES:开启 NO:关闭


@end


@interface UIView(UIViewAnimationWithBlock s)


+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0);   动画效果处理块


+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); // delay = 0.0, options = 0   动画效果处理块,无延迟


+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations NS_AVAILABLE_IOS(4_0); // delay = 0.0, options = 0, completion = NULL   动画效果处理块。无延迟,简单版


+ (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); 过渡动画处理块


+ (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); // toView added to fromView.superview, fromView removed from its superview 视图之间切换过渡动画处理块


@end


@interface UIView (UIViewGestureRecognizers )


@property(nonatomic,copy) NSArray *gestureRecognizers NS_AVAILABLE_IOS(3_2); 手势识别器


- (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer NS_AVAILABLE_IOS(3_2);绑定手势到视图
- (void)removeGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer NS_AVAILABLE_IOS(3_2);从视图中分离手势


// called when the recognizer attempts to transition out of UIGestureRecognizerState Possible if a touch hit-tested to this view will be cancelled as a result of gesture recognition
// returns YES by default. return NO to cause the gesture recognizer to transition to UIGestureRecognizerState Failed
// subclasses may override to prevent recognition of particular gestures. for example, UISlider prevents swipes parallel to the slider that start in the thumb
- (BOOL)gestureRecognizerShouldB egin:(UIGestureRecognizer *)gestureRecognizer NS_AVAILABLE_IOS(6_0); 手势识别处理方式


@end




//
// UIView Constraint-based Layout Support
//


typedef NS_ENUM(NSInteger, UILayoutConstraintAxis) {
      UILayoutConstraintAxisHo rizontal = 0,
      UILayoutConstraintAxisVe rtical = 1
};


// Installing Constraints


@interface UIView (UIConstraintBasedLayoutI nstallingConstraints)


- (NSArray *)constraints NS_AVAILABLE_IOS(6_0);视图布局约束


- (void)addConstraint:(NSLayoutConstraint *)constraint NS_AVAILABLE_IOS(6_0);/视图布局上添加一个约束
- (void)addConstraints:(NSArray *)constraints NS_AVAILABLE_IOS(6_0);视图布局上添加多个约束
- (void)removeConstraint:(NSLayoutConstraint *)constraint NS_AVAILABLE_IOS(6_0);移除视图布局上的一个约束
- (void)removeConstraints:(NSArray *)constraints NS_AVAILABLE_IOS(6_0);移除视图布局上的多个约束
@end


// Core Layout Methods




@interface UIView (UIConstraintBasedLayoutC oreMethods) 
- (void)updateConstraintsIfNeede d NS_AVAILABLE_IOS(6_0); // Updates the constraints from the bottom up for the view hierarchy rooted at the receiver. UIWindow's implementation creates a layout engine if necessary first. 调用新的视图布局自动触发,更新视图布局上的约束
- (void)updateConstraints NS_AVAILABLE_IOS(6_0); // Override this to adjust your special constraints during a constraints update pass更新自定义视图布局约束
- (BOOL)needsUpdateConstraints NS_AVAILABLE_IOS(6_0);判断视图布局是否需要更新约束
- (void)setNeedsUpdateConstraint s NS_AVAILABLE_IOS(6_0);设置视图布局是否需要更新约束
@end


// Compatibility and Adoption


@interface UIView (UIConstraintBasedCompati bility) 


- (BOOL)translatesAutoresizingMa skIntoConstraints NS_AVAILABLE_IOS(6_0); // Default YES   标示是否自动遵循视图布局约束
- (void)setTranslatesAutoresizin gMaskIntoConstraints:(BOOL)flag NS_AVAILABLE_IOS(6_0); 设置是否自动遵循视图布局约束


+ (BOOL)requiresConstraintBasedL ayout NS_AVAILABLE_IOS(6_0); 返回是遵循自定义视图布局约束


@end


// Separation of Concerns


@interface UIView (UIConstraintBasedLayoutL ayering)




- (CGRect)alignmentRectForFrame:(CGRect)frame NS_AVAILABLE_IOS(6_0);返回矩形对于指定视图框架。
- (CGRect)frameForAlignmentRect:(CGRect)alignmentRect NS_AVAILABLE_IOS(6_0);返回框架对于指定视图矩形


- (UIEdgeInsets)alignmentRectInsets NS_AVAILABLE_IOS(6_0);返回自定义视图框架


- (UIView *)viewForBaselineLayout NS_AVAILABLE_IOS(6_0);如果超出约束范围,自动生成基线限制,以满足视图需求




UIKIT_EXTERN const CGFloat UIViewNoIntrinsicMetric NS_AVAILABLE_IOS(6_0); // -1
- (CGSize)intrinsicContentSize NS_AVAILABLE_IOS(6_0); 返回自定义视图大小
- (void)invalidateIntrinsicConte ntSize NS_AVAILABLE_IOS(6_0); // call this when something changes that affects the intrinsicContentSize.   Otherwise UIKit won't notice that it changed.    自定义视图内容大小无效


- (UILayoutPriority)contentHuggingPriorityFo rAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0);返回放大的视图布局的轴线
- (void)setContentHuggingPriorit y:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0);设置放大的视图布局的轴线


- (UILayoutPriority)contentCompressionResist ancePriorityForAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0);返回缩小的视图布局的轴线
- (void)setContentCompressionRes istancePriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0);设置缩小的视图布局的轴线
@end


// Size To Fit


UIKIT_EXTERN const CGSize UILayoutFittingCompresse dSize NS_AVAILABLE_IOS(6_0);
UIKIT_EXTERN const CGSize UILayoutFittingExpandedS ize NS_AVAILABLE_IOS(6_0);


@interface UIView (UIConstraintBasedLayoutF ittingSize)
- (CGSize)systemLayoutSizeFittingS ize:(CGSize)targetSize NS_AVAILABLE_IOS(6_0);满足约束视图布局的大小
@end


// Debugging


@interface UIView (UIConstraintBasedLayoutD ebugging)


- (NSArray *)constraintsAffectingLayo utForAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0);返回影响视图布局限制的轴线


- (BOOL)hasAmbiguousLayout NS_AVAILABLE_IOS(6_0);返回视图布局约束是否影响指定视图,主要用于调试约束布局,结合exerciseAmbiguityInLayou t。
- (void)exerciseAmbiguityInLayou t NS_AVAILABLE_IOS(6_0);   随机改变不同效值布局视图,主要用于调试基于约束布局的视图
@end


@interface UIView (UIStateRestoration)
@property (nonatomic, copy) NSString *restorationIdentifier NS_AVAILABLE_IOS(6_0);标示是否支持保存,恢复视图状态信息
- (void) encodeRestorableStateWit hCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);保存视图状态相关信息
- (void) decodeRestorableStateWit hCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); 恢复和保持视图状态相关信息
@end
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值