• UIView的API


    - (instancetype)initWithFrame:(CGRect)frame;

    使用指定的框架矩形初始化并返回新分配的视图对象。

     

    - (instancetype)initWithCoder:(NSCoder *)aDecoder;

     

    @property(nonatomic, copy) UIColor *backgroundColor;

    视图的背景颜色。

     

    @property(nonatomic, getter=isHidden) BOOL hidden;

    一个布尔值,用于确定是否隐藏视图。

     

    @property(nonatomic) CGFloat alpha;

    视图的alpha值。

     

    @property(nonatomic, getter=isOpaque) BOOL opaque;

    一个布尔值,用于确定视图是否不透明。

     

    @property(nonatomic, strong) UIColor *tintColor;

    视图层次结构中的第一个非默认色调值,从视图本身开始上升和开始。

     

    @property(nonatomic) UIViewTintAdjustmentMode tintAdjustmentMode;

    视图层次结构中的第一个非默认色调调整模式值,从视图本身开始上升和开始。

     

    @property(nonatomic) BOOL clipsToBounds;

    一个布尔值,用于确定子视图是否仅限于视图的边界。

     

    @property(nonatomic) BOOL clearsContextBeforeDrawing;

    一个布尔值,用于确定在绘制之前是否应自动清除视图的边界。

     

    @property(nonatomic, strong) UIView *maskView;

    一个可选视图,其alpha通道用于屏蔽视图的内容。

     

    @property(class, nonatomic, readonly) Class layerClass;

    返回用于为此类的实例创建图层的类。

     

    @property(nonatomic, readonly, strong) CALayer *layer;

    视图的核心动画层用于渲染。

     

    @property(nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled;

    一个布尔值,用于确定是否忽略用户事件并从事件队列中删除。

     

    @property(nonatomic, getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled;

    一个布尔值,指示视图是否一次接收多个触摸。

     

    @property(nonatomic, getter=isExclusiveTouch) BOOL exclusiveTouch;

    一个布尔值,指示接收器是否专门处理触摸事件。

     

    @property(nonatomic) CGRect frame;

    框架矩形,用于描述超视图坐标系中视图的位置和大小。

     

    @property(nonatomic) CGRect bounds;

    边界矩形,用于描述视图在其自身坐标系中的位置和大小。

     

    @property(nonatomic) CGPoint center;

    视图框架矩形的中心点。

     

    @property(nonatomic) CGAffineTransform transform;

    指定应用于视图的变换,相对于其边界的中心。

     

    @property(nonatomic, readonly) UIView *superview;

    接收者的超级视图,或者nil如果没有。

     

    @property(nonatomic, readonly, copy) NSArray<__kindof UIView *> *subviews;

    接收者的直接子视图。

     

    @property(nonatomic, readonly) UIWindow *window;

    接收者的窗口对象,或者nil它没有。

     

    - (void)addSubview:(UIView *)view;

    将视图添加到接收者的子视图列表的末尾。

     

    - (void)bringSubviewToFront:(UIView *)view;

    移动指定的子视图,使其显示在其兄弟节点之上。

     

    - (void)sendSubviewToBack:(UIView *)view;

    移动指定的子视图,使其显示在其兄弟节点后面。

     

    - (void)removeFromSuperview;

    取消链接视图与其超级视图及其窗口,并将其从响应程序链中删除。

     

    - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;

    在指定的索引处插入子视图。

     

    - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;

    在视图层次结构中的另一个视图上方插入视图。

     

    - (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;

    在视图层次结构中的另一个视图下插入视图。

     

    - (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;

    在指定的索引处交换子视图。

     

    - (BOOL)isDescendantOfView:(UIView *)view;

    返回一个布尔值,指示接收者是给定视图的子视图还是与该视图相同。

     

    - (void)didAddSubview:(UIView *)subview;

    告诉我们添加了一个子视图。

     

    - (void)willRemoveSubview:(UIView *)subview;

    告诉我们要删除子视图。

     

    - (void)willMoveToSuperview:(UIView *)newSuperview;

    告诉他们的superview即将更改为指定的superview。

     

    - (void)didMoveToSuperview;

    告诉他们超级视图发生了变化。

     

    - (void)willMoveToWindow:(UIWindow *)newWindow;

    告诉视图它的窗口对象即将改变。

     

    - (void)didMoveToWindow;

    告诉视图它的窗口对象已更改。

     

    @property(nonatomic) NSDirectionalEdgeInsets directionalLayoutMargins;

    考虑当前语言方向时在视图中布局内容时使用的默认间距。

     

    @property(nonatomic) UIEdgeInsets layoutMargins;

    在视图中布局内容时使用的默认间距。

     

    @property(nonatomic) BOOL preservesSuperviewLayoutMargins;

    一个布尔值,指示当前视图是否也遵循其超级视图的边距。

     

    - (void)layoutMarginsDidChange;

    通知视图布局边距已更改。

     

    @property(nonatomic, readonly) UIEdgeInsets safeAreaInsets;

    用于确定此视图的安全区域的插图。

     

    @property(nonatomic, readonly, strong) UILayoutGuide *safeAreaLayoutGuide;

    布局指南表示视图中不受条形和其他内容影响的部分。

     

    - (void)safeAreaInsetsDidChange;

    在视图的安全区域发生更改时调用。

     

    @property(nonatomic) BOOL insetsLayoutMarginsFromSafeArea;

    一个布尔值,指示视图的布局边距是否自动更新以反映安全区域。

     

    @property(nonatomic, readonly) NSArray<__kindof NSLayoutConstraint *> *constraints;

     

     

    - (void)addConstraint:(NSLayoutConstraint *)constraint;

    在接收视图或其子视图的布局上添加约束。

     

    - (void)addConstraints:(NSArray<__kindof NSLayoutConstraint *> *)constraints;

    在接收视图或其子视图的布局上添加多个约束。

     

    - (void)removeConstraint:(NSLayoutConstraint *)constraint;

    从视图中删除指定的约束。

     

    - (void)removeConstraints:(NSArray<__kindof NSLayoutConstraint *> *)constraints;

    从视图中删除指定的约束。

     

    @property(nonatomic, readonly, strong) NSLayoutYAxisAnchor *bottomAnchor;

    一个布局锚点,表示视图框架的下边缘。

     

    @property(nonatomic, readonly, strong) NSLayoutXAxisAnchor *centerXAnchor;

    一个布局锚点,表示视图框架的水平中心。

     

    @property(nonatomic, readonly, strong) NSLayoutYAxisAnchor *centerYAnchor;

    一个布局锚点,表示视图框架的垂直中心。

     

    @property(nonatomic, readonly, strong) NSLayoutYAxisAnchor *firstBaselineAnchor;

    一个布局锚点,表示视图中最顶部文本行的基线。

     

    @property(nonatomic, readonly, strong) NSLayoutDimension *heightAnchor;

    一个布局锚点,表示视图框架的高度。

     

    @property(nonatomic, readonly, strong) NSLayoutYAxisAnchor *lastBaselineAnchor;

    一个布局锚点,表示视图中最底部文本行的基线。

     

    @property(nonatomic, readonly, strong) NSLayoutXAxisAnchor *leadingAnchor;

    表示视图框架前缘的布局锚点。

     

    @property(nonatomic, readonly, strong) NSLayoutXAxisAnchor *leftAnchor;

    一个布局锚点,表示视图框架的左边缘。

     

    @property(nonatomic, readonly, strong) NSLayoutXAxisAnchor *rightAnchor;

    一个布局锚点,表示视图框架的右边缘。

     

    @property(nonatomic, readonly, strong) NSLayoutYAxisAnchor *topAnchor;

    一个布局锚点,表示视图框架的上边缘。

     

    @property(nonatomic, readonly, strong) NSLayoutXAxisAnchor *trailingAnchor;

    一个布局锚点,表示视图框架的后缘。

     

    @property(nonatomic, readonly, strong) NSLayoutDimension *widthAnchor;

    一个布局锚点,表示视图框架的宽度。

     

    • (void)addLayoutGuide:(UILayoutGuide *)layoutGuide;

    将指定的布局指南添加到视图中。

     

    @property(nonatomic, readonly, copy) NSArray<__kindof UILayoutGuide *> *layoutGuides;

    此视图拥有的布局指南对象数组。

     

    @property(readonly, strong) UILayoutGuide *layoutMarginsGuide;

    表示视图边距的布局指南。

     

    @property(nonatomic, readonly, strong) UILayoutGuide *readableContentGuide;

    布局指南,表示视图中具有可读宽度的区域。

     

    - (void)removeLayoutGuide:(UILayoutGuide *)layoutGuide;

    从视图中删除指定的布局指南。

     

    - (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize;

    根据当前约束返回视图的最佳大小。

     

    - (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize withHorizontalFittingPriority:(UILayoutPriority)horizontalFittingPriority verticalFittingPriority:(UILayoutPriority)verticalFittingPriority;

    根据约束和指定的拟合优先级返回视图的最佳大小。

     

    @property(nonatomic, readonly) CGSize intrinsicContentSize;

    接收视图的自然大小,仅考虑视图本身的属性。

     

    - (void)invalidateIntrinsicContentSize;

    使视图的内在内容大小无效。

     

    - (UILayoutPriority)contentCompressionResistancePriorityForAxis:(UILayoutConstraintAxis)axis;

    返回视图抵制的优先级小于其内部大小的优先级。

     

    - (void)setContentCompressionResistancePriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis;

    设置视图抵抗的优先级小于其内在大小。

     

    - (UILayoutPriority)contentHuggingPriorityForAxis:(UILayoutConstraintAxis)axis;

    返回视图阻止大于其内部大小的优先级。

     

    - (void)setContentHuggingPriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis;

    设置视图抵抗的优先级大于其内在大小。

     

    - (CGRect)alignmentRectForFrame:(CGRect)frame;

    返回给定帧的视图对齐矩形。

     

    - (CGRect)frameForAlignmentRect:(CGRect)alignmentRect;

    返回给定对齐矩形的视图框架。

     

    @property(nonatomic, readonly) UIEdgeInsets alignmentRectInsets;

    视图框架中的插图定义其对齐矩形。

     

    - (UIView *)viewForBaselineLayout;

    返回用于满足基线约束的视图。

     

    @property(readonly, strong) UIView *viewForFirstBaselineLayout;

    返回用于满足第一个基线约束的视图。

     

    @property(readonly, strong) UIView *viewForLastBaselineLayout;

    返回用于满足上一个基线约束的视图。

     

    - (BOOL)needsUpdateConstraints;

    一个布尔值,用于确定视图的约束是否需要更新。

     

    - (void)setNeedsUpdateConstraints;

    控制视图的约束是否需要更新。

     

    - (void)updateConstraints;

    更新视图的约束。

     

    - (void)updateConstraintsIfNeeded;

    更新接收视图及其子视图的约束。

     

    - (NSArray<__kindof NSLayoutConstraint *> *)constraintsAffectingLayoutForAxis:(UILayoutConstraintAxis)axis;

    返回影响给定轴的视图布局的约束。

     

    @property(nonatomic, readonly) BOOL hasAmbiguousLayout;

    一个布尔值,用于确定影响视图布局的约束是否未完全指定视图的位置。

     

    - (void)exerciseAmbiguityInLayout;

    随机更改视图的框架,在不同的有效值之间使用不明确的布局。

    @property(nonatomic) UIViewContentMode contentMode;

    用于确定视图在其边界更改时如何布置其内容的标志。

     

    @property(nonatomic) CGRect contentStretch;

    用于指定视图在其大小更改时如何调整其内容的选项。

     

    - (CGSize)sizeThatFits:(CGSize)size;

    要求视图计算并返回最适合指定大小的大小。

     

    - (void)sizeToFit;

    调整接收器视图的大小并移动它,使其只包含其子视图。

     

    @property(nonatomic) BOOL autoresizesSubviews;

    一个布尔值,用于确定接收器在其边界更改时是否自动调整其子视图的大小。

     

    roperty(nonatomic) UIViewAutoresizing autoresizingMask;

    一个整数位掩码,用于确定接收器在超视图边界发生变化时如何调整自身大小。

     

    - (void)layoutSubviews;

    布置子视图。

     

    - (void)setNeedsLayout;

    使接收器的当前布局无效并在下一个更新周期期间触发布局更新。

     

    - (void)layoutIfNeeded;

    如果布局更新处于待处理状态,则立即布置子视图。

     

    @property(class, nonatomic, readonly) BOOL requiresConstraintBasedLayout;

    一个布尔值,指示接收器是否依赖于基于约束的布局系统。

     

    @property(nonatomic) BOOL translatesAutoresizingMaskIntoConstraints;

    一个布尔值,用于确定视图的自动调整遮罩是否已转换为自动布局约束。

     

    @property(nonatomic) UISemanticContentAttribute semanticContentAttribute;

    视图内容的语义描述,用于确定在从左到右和从右到左布局之间切换时是否应该翻转视图。

     

    @property(readonly, nonatomic) UIUserInterfaceLayoutDirection effectiveUserInterfaceLayoutDirection;

    用户界面布局方向适合于安排视图的直接内容。

     

    +(UIUserInterfaceLayoutDirection)userInterfaceLayoutDirectionForSemanticContentAttribute:(UISemanticContentAttribute)attribute;

    返回给定语义内容属性的用户界面方向。

     

    +(UIUserInterfaceLayoutDirection)userInterfaceLayoutDirectionForSemanticContentAttribute:(UISemanticContentAttribute)semanticContentAttribute relativeToLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection;

    返回指定语义内容属性隐含的布局方向,相对于指定的布局方向。

     

    - (void)addInteraction:(id<UIInteraction>)interaction;

    向视图添加交互。

     

    - (void)removeInteraction:(id<UIInteraction>)interaction;

    从视图中删除交互。

     

    @property(nonatomic, copy) NSArray<id<UIInteraction>> *interactions;

    视图的交互数组。

     

    - (void)drawRect:(CGRect)rect;

    在传入的矩形内绘制接收器的图像。

     

    - (void)setNeedsDisplay;

    将接收器的整个边界矩形标记为需要重绘。

     

    - (void)setNeedsDisplayInRect:(CGRect)rect;

    将接收器的指定矩形标记为需要重绘。

     

    @property(nonatomic) CGFloat contentScaleFactor;

    应用于视图的比例因子。

     

    - (void)tintColorDidChange;

    tintColor属性更改时由系统调用。

     

    - (UIViewPrintFormatter *)viewPrintFormatter;

    返回接收视图的打印格式化程序。

     

    - (void)drawRect:(CGRect)rect forViewPrintFormatter:(UIViewPrintFormatter *)formatter;

    已实现绘制视图的内容以进行打印。

     

    - (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;

    将手势识别器附加到视图。

     

    - (void)removeGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;

    从接收视图中分离手势识别器。

     

    @property(nonatomic, copy) NSArray<__kindof UIGestureRecognizer *> *gestureRecognizers;

    当前附加到视图的手势识别器对象。

     

    - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer;

    询问是否应允许手势识别器继续跟踪触摸事件。

     

    @property(nonatomic, readonly) BOOL canBecomeFocused;

    一个布尔值,指示视图当前是否能够被聚焦。

     

    @property(class, nonatomic, readonly) NSTimeInterval inheritedAnimationDuration;

    返回当前动画的继承持续时间。

     

    @property(readonly, nonatomic, getter=isFocused) BOOL focused;

    一个布尔值,指示项目当前是否已聚焦。

     

    - (void)addMotionEffect:(UIMotionEffect *)effect;

    开始将动画效果应用于视图。

     

    @property(copy, nonatomic) NSArray<__kindof UIMotionEffect *> *motionEffects;

    视图的运动效果数组。

     

    - (void)removeMotionEffect:(UIMotionEffect *)effect;

    停止将动画效果应用于视图。

     

    @property(nonatomic, copy) NSString *restorationIdentifier;

    确定视图是否支持状态恢复的标识符。

     

    - (void)encodeRestorableStateWithCoder:(NSCoder *)coder;

    编码视图的状态相关信息。

     

    - (void)decodeRestorableStateWithCoder:(NSCoder *)coder;

    解码和恢复视图的状态相关信息。

     

    - (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates;

    返回基于当前视图内容的快照视图。

     

    - (UIView *)resizableSnapshotViewFromRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates withCapInsets:(UIEdgeInsets)capInsets;

    返回基于当前视图的指定内容的快照视图,具有可伸展的插入。

     

    - (BOOL)drawViewHierarchyInRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates;

    将完整视图层次结构的快照呈现为屏幕上可见的当前上下文。

     

    @property(nonatomic) NSInteger tag;

    一个整数,可用于标识应用程序中的视图对象。

     

    - (__kindof UIView *)viewWithTag:(NSInteger)tag;

    返回其标记与指定值匹配的视图。

     

    - (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;

    将矩形从另一个视图的坐标系转换为接收器的坐标系。

     

    - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;

    返回包含指定点的视图层次结构(包括其自身)中接收器的最远后代。

     

    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;

    返回一个布尔值,指示接收器是否包含指定的点。

     

    - (BOOL)endEditing:(BOOL)force;

    导致视图(或其中一个嵌入的文本字段)重新签署第一个响应者状态。

     

    @property(nonatomic) BOOL accessibilityIgnoresInvertColors;

    一个布尔值,指示视图是否忽略可转换其颜色的辅助功能请求。

     

    +(void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

    使用指定的持续时间,延迟,选项和完成处理程序对一个或多个视图进行动画更改。

     

    +(void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

    使用指定的持续时间和完成处理程序对一个或多个视图进行动画更改。

     

    +(void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations;

    使用指定的持续时间对一个或多个视图进行动画更改。

     

    +(void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

    为指定的容器视图创建过渡动画。

     

    +(void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion;

    使用给定参数在指定视图之间创建过渡动画。

     

    +(void)animateKeyframesWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewKeyframeAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

    创建一个动画块对象,可用于为当前视图设置基于关键帧的动画。

     

    +(void)addKeyframeWithRelativeStartTime:(double)frameStartTime relativeDuration:(double)frameDuration animations:(void (^)(void))animations;

    指定关键帧动画的单个帧的计时和动画值。

     

    +(void)performSystemAnimation:(UISystemAnimation)animation onViews:(NSArray<__kindof UIView *> *)views options:(UIViewAnimationOptions)options animations:(void (^)(void))parallelAnimations completion:(void (^)(BOOL finished))completion;

    在一个或多个视图上执行指定的系统提供的动画,以及您定义的可选并行动画。

     

    +(void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

    使用与物理弹簧的运动相对应的定时曲线执行视图动画。

     

    +(void)performWithoutAnimation:(void (^)(void))actionsWithoutAnimation;

    禁用视图过渡动画。

     

    +(void)beginAnimations:(NSString *)animationID context:(void *)context;

    标记开始/提交动画块的开头。

     

    +(void)commitAnimations;

    标记开始/提交动画块的结尾并安排动画执行。

     

    +(void)setAnimationStartDate:(NSDate *)startDate;

    设置当前动画块的开始时间。

     

    +(void)setAnimationsEnabled:(BOOL)enabled;

    设置是否启用动画。

     

    +(void)setAnimationDelegate:(id)delegate;

    设置任何动画消息的委托。

     

    +(void)setAnimationWillStartSelector:(SEL)selector;

    设置动画开始时发送给动画委托的消息。

     

    +(void)setAnimationDidStopSelector:(SEL)selector;

    设置动画停止时要发送给动画委托的消息。

     

    +(void)setAnimationDuration:(NSTimeInterval)duration;

    设置动画块中动画的持续时间(以秒为单位)。

     

    +(void)setAnimationDelay:(NSTimeInterval)delay;设置动画块中动画属性更改之前等待的时间(以秒为单位)。

    +(void)setAnimationCurve:(UIViewAnimationCurve)curve;

    设置动画块中动画属性更改时要使用的曲线。

     

    +(void)setAnimationRepeatCount:(float)repeatCount;

    设置动画块中动画重复的次数。

     

    +(void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses;

    设置动画块中的动画是否自动反转。

     

    +(void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState;

    设置动画是否应从当前状态开始播放。

     

    +(void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache;

    设置在动画块期间应用于视图的过渡。

     

    @property(class, nonatomic, readonly) BOOL areAnimationsEnabled;

    返回一个布尔值,指示是否启用动画。

     

     

     

  • 相关阅读:
    并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue用法
    RabbitMQ官方文档翻译之Remote procedure call(六)
    RabbitMQ官方文档翻译之Topics(五)
    数据库调优教程(八) 什么情况下不要使用索引
    数据库调优教程(七)索引的代价
    数据库调优教程(六) 索引的相关操作
    数据库调优教程(五) 索引的作用和索引的种类
    数据库调优教程(四)Explain性能分析命令
    数据库调优教程(三)记录慢查询
    数据库调优教程(二)慢查询数据准备
  • 原文地址:https://www.cnblogs.com/cchHers/p/11243777.html
Copyright © 2020-2023  润新知