zoukankan      html  css  js  c++  java
  • UI控件的常见属性

    UIView的常见属性:

    //获得自己的父控件对象
    @property(nonatomic,readonly) UIView *superview;
    
    //获得自己的所有子控件对象
    @property(nonatomic,readonly,copy) NSArray *subviews;
    
    //控件的ID\标识,父控件可以通过tag来找到对应的子控件
    @property(nonatomic) NSInteger tag;
    
    //控件的形变属性(可以设置旋转角度、比例缩放、平移等属性
    @property(nonatomic) CGAffineTransform transform;
    //控件所在矩形框在父控件中的位置和尺寸(以父控件的左上角为坐标原点)
    @property(nonatomic) CGRect frame;
    
    //控件所在矩形框的位置和尺寸(以自己左上角为坐标原点,所以bounds的x\y一般为0)
    @property(nonatomic) CGRect bounds;
    
    //控件中点的位置(以父控件的左上角为坐标原点)
    @property(nonatomic) CGPoint center;
    •在UIKit中,坐标系的原点(0,0)在左上角,x值向右正向延伸,y值向下正向延伸

    UILabel的常见属性:

    //label显示的文字
    @property(nonatomic,copy)   NSString *text;
    
    //文字字体大小
    @property(nonatomic,retain) UIFont *font;
    
    //文字的颜色
    @property(nonatomic,retain) UIColor *textColor;
    
    //文字的排列方式(左对齐、居中、右对齐)枚举值
    @property(nonatomic)NSTextAlignment textAlignment;
    
    // 设置行数(行数==0代表自动换行)
    @property(nonatomic) NSInteger numberOfLines;

    UIImageView的常见属性:

    // 所要显示的图片
    @property(nonatomic,retain) UIImage *image;
    
    // 设置序列帧动画数组(按顺序播放animationImages数组中的图片)
    @property(nonatomic,copy) NSArray *animationImages;
    
    // 序列帧动画的持续时间
    @property(nonatomic) NSTimeInterval animationDuration;
    
    // 序列帧动画的执行次数(默认是0,代表无限循环)
    @property(nonatomic) NSInteger animationRepeatCount;

    UIScrollView的常见属性:

    // 表示UIScrollView所滚动的位置
    @property(nonatomic) CGPoint contentOffset;
    
    // 表示UIScrollView的内容尺寸(能滚动的范围)
    @property(nonatomic) CGSize contentSize;
    
    // 增加UIScrollView额外的边缘滚动区域
    @property(nonatomic)UIEdgeInsets contentInset;
    
    // 代理
    @property(nonatomic,assign) id<UIScrollViewDelegate>delegate;

    下图介绍了UIScrollView的几个常见属性

    待续................................

  • 相关阅读:
    设计模式----工厂模式
    设计模式----简单工厂
    log4net使用详解
    link/Extended dependency 无法显示连接
    Abp框架之执行Update-Database 命令系列错误
    Index API
    使用Java客户端操作elasticsearch(二)
    elasticsearch之分词插件使用
    使用Java Low Level REST Client操作elasticsearch
    js如何获取隐藏的元素的高度
  • 原文地址:https://www.cnblogs.com/hukezhu/p/4499137.html
Copyright © 2011-2022 走看看