UI控件之UILabel
来源:互联网 发布:win10 办公软件 编辑:程序博客网 时间:2024/06/04 23:33
// Created by Catherine on 2017/8/28.
// Copyright © 2017年 Catherine. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
overridefunc viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let label :UILabel = UILabel(frame: CGRect(x:120, y: 100, width:200, height: 300))
//设置label上的文字
label.text = "I am a label"
//设置字体
label.font = UIFont.boldSystemFont(ofSize: 19)
//设置字体的颜色
label.textColor = UIColor.blue
//label.textColor = UIColor(colorLiteralRed: <#T##Float#>, green: <#T##Float#>, blue: <#T##Float#>, alpha: <#T##Float#>)
//alpha是透明度
//设置label的背景颜色
label.backgroundColor = UIColor.magenta
//设置文字的对齐方式
label.textAlignment = NSTextAlignment.center
//设置label的阴影
label.shadowColor = UIColor.orange
//设置阴影的偏移范围 (width向右偏移 height向下移动)
label.shadowOffset = CGSize(width: 30, height:10)
//设置label的行数 =0是无限行展示
label.numberOfLines = 2
self.view.addSubview(label)
}
overridefunc didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
- UI控件之UILabel
- iOS UI基础控件之UILabel
- iOS-UI-基本控件之UILabel
- UI控件笔记(二):UI之UILabel和UIImageView
- UI控件--UILabel
- iOS-UI控件精讲之【2】-UILabel
- IOS#UI之UIlabel
- UI基础之--UILabel
- UI常用控件UILabel、TestField
- UI -UIView和UILabel控件
- 基本控件之UILabel
- iOS控件之UILabel
- iOS控件之UILabel
- iOS控件之UILabel
- 常用控件之--------UILabel
- iOS UI界面之UILabel
- iOS之UI学习-UILabel
- UI之UILabel和UIImageView
- 我教宝宝学AI (二)基础知识
- MSComm控件需要注意事项
- 卫星电视转 IPTV流媒体监测方案
- 简单三步帮你建立博客
- Cpp-关于变量
- UI控件之UILabel
- mysql常用统计sql记录
- pyspark-wordcount
- 剑指Offer—42—和为S的两个数字
- iOS socket 简单使用
- 关于内存泄漏和内存分析检测的简单描述
- JVM调优总结
- CSS3 鲜为人知的属性-webkit-tap-highlight-color的理解
- java虚拟机、jdbc的statement