iOS UIView 一些属性方法总结 - Go语言中文社区

iOS UIView 一些属性方法总结


UIView 是视图基类,以下这这类结构图可以看出view 常用UI空间都是这个类的子类








1 view 位置几何 UIViewGeometry
     常用的有 
     frame
     bounds 
     center 
     transform(默认是CGAffineTransformIdentity。可以做成动画)
     multipleTouchEnabled(当前视图是否接受多点触控事件,缺省值为NO)
     exclusiveTouch (当前视图是否接受单点触控,默认值是no)
     autoresizesSubviews(这个属性是决定当视图大小边界发生改变时,其子视图是否也跟着自动调整大小)
     autoresizingMask(简单的调整。默认是UIViewAutoresizingNone)
     
2: UIView层次结构
     superview(父视图)
     subviews(子视图)返回时数组
     window(窗口)
     - (void)removeFromSuperview;(从父视图上移除)
     - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;(插入一个视图在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;(将要移除子视图)
     - (nullable __kindof UIView *)viewWithTag:(NSInteger)tag;(根据tag值获取视图)
     - (void)setNeedsLayout;(强制布局)
     - (void)layoutIfNeeded;
3: UIViewRendering(UIView呈现)
      clipsToBounds(是的,内容和子视图省略视图的范围。默认是否定的。)
      alpha (透明度,默认值是一)
      hidden(是否隐藏视图,默认是不隐藏)
      tintColor (色调颜色,开始用于IOS7)
4:UIViewAnimation(视图动画)
     + (void)beginAnimations:(nullable NSString *)animationID context:(nullable void *)context;(UIViewRenderingadditional上下文信息传递给会启动/停止选择器。开始/提交可以嵌套)
     + (void)commitAnimations;开始动画
     
     + (void)setAnimationDelegate:(nullable id)delegate;(设置代理)
     + (void)setAnimationWillStartSelector:(nullable SEL)selector;                // default = NULL. -animationWillStart:(NSString *)animationID context:(void *)context
     + (void)setAnimationDidStopSelector:(nullable SEL)selector;                  // default = NULL. -animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
     + (void)setAnimationDuration:(NSTimeInterval)duration;              // default = 0.2
     + (void)setAnimationDelay:(NSTimeInterval)delay;                    // default = 0.0
     + (void)setAnimationStartDate:(NSDate *)startDate;
     
5:UIViewAnimationWithBlocks(动画块)
     常用的方法
     1 + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^ __nullable)(BOOL finished))completion NS_AVAILABLE_IOS(4_0);
     2 + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^ __nullable)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); // delay = 0.0, options = 0
     
     */
    


版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/wang1018960145/article/details/50897920
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-03-07 13:15:35
  • 阅读 ( 888 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢