zoukankan      html  css  js  c++  java
  • iOS-UILabel的使用

     常用属性UILabel
    //显示的文字
    @property(nonatomic,copy)   NSString           *text;
    //字体
    @property(nonatomic,retain) UIFont             *font;
    //文字颜色
    @property(nonatomic,retain) UIColor            *textColor;
    //对齐模式(比如左对齐、居中对齐、右对齐)
    @property(nonatomic)        NSTextAlignment    textAlignment;

    [label setTextAlignment:NSTextAlignmentCenter]; //文字显示的位置

    self.titleLabel.font = [UIFont systemFontOfSize:12]; //文字的大小
    /根据字体大小、宽度、换行模式获得字体的高度

    NSString *str = self.textLabel.text;

    CGSize textSize = [str sizeWithFont:UIFont systemFontOfSize:14.0] constrainedToSize:CGSizeMake(w, 10000)

    lineBreakMode:NOLine];

    CGFloat h = textSize.height;
    [_textLabel setNumberOfLines:0]; //自动换行
  • 相关阅读:
    RPA-UiPath视频教程2
    skywalking链路监控
    RPA-UiPath视频教程1
    Redis基础与性能调优
    tomcat调优
    DDos、CC攻击与防御
    UiPath官方视频Level2
    UiPath直播课程
    UiPath手把手教程
    【0】python核心编程,第二章
  • 原文地址:https://www.cnblogs.com/linxiu-0925/p/5058121.html
Copyright © 2011-2022 走看看