-
-
措言
2017-06-08
- Color
-
截图
0赞 · 0采集
-
-
措言
2017-06-08
- colorStripe
-
截图
0赞 · 0采集
-
-
措言
2017-06-08
- backView
-
截图
0赞 · 0采集
-
-
措言
2017-06-08
- colorStripe
-
截图
0赞 · 0采集
-
-
措言
2017-06-08
- CGRect
-
截图
0赞 · 0采集
-
-
措言
2017-06-08
- UIView
-
截图
0赞 · 0采集
-
-
措言
2017-06-08
- let colors
-
截图
0赞 · 0采集
-
-
Code_浅蓝
2016-09-21
- var backView = UIView(frame : CGRectMake(0.0, 0.0, 320.0, CGFloat(colors.count * 50)))
backView.backgroundColor = UIColor.blackColor()
backView
var indexP = 0
for (colorName,rgbTuple) in colors
{
// var colorStripe = UILabel(frame:CGRectMake(0, CGFloat(index*50 + 5), 320.0, 40.0))
// index ++
var colorStripe = UILabel(frame : CGRectMake(0.0, CGFloat(indexP*50 + 5), 320.0, 40.0))
// colorStripe.text! = colorName
colorStripe.text = colorName
colorStripe.textAlignment = NSTextAlignment.Center
colorStripe.backgroundColor = UIColor(red: CGFloat(rgbTuple.red/255.0), green: CGFloat(rgbTuple.green/255.0), blue: CGFloat(rgbTuple.blue/255.0), alpha: 1.0)
indexP += 1
backView.addSubview(colorStripe)
}
backView
-
0赞 · 0采集
-
-
大树先生丶
2016-03-29
- 构建颜色字典
构建back view
赋值背景颜色
对颜色进行遍历----在循环体里
ColorStripe
创建UILable定义位置和大小
将字典中的颜色取出来赋给UIlable的背景颜色
将UIlable送到view中
ColorNameLable
构建字体UILable并且定义位置
设置字体和大小
设置字体的颜色为背景颜色
设置字体的对齐方式
设置字体的熟知
将Lable送到View中
-
0赞 · 0采集
-
-
生活在地下a
2015-11-25
- 111
-
截图
0赞 · 0采集
-
-
LXChild
2015-11-01
- add
-
截图
0赞 · 0采集
-
-
肥宅小鈞
2015-09-29
- uiview -> uilabel
-
截图
0赞 · 0采集
-
-
papada
2015-09-22
- ????
-
0赞 · 0采集
-
-
John_Pan
2015-07-21
- 控件的位置由frame属性决定
每一个控件在创立的时候可以指定frame
frame是CGRect结构的
包含x,y,width,height四个浮点型
frame是相对父视图而言
-
截图
0赞 · 0采集
-
-
John_Pan
2015-07-21
- cocoa touch 基本结构
-
截图
0赞 · 0采集
-
-
2012还是1984
2015-07-07
- var index = 0
for (colorName,rgbTuple) in colors
{
var colorStripe = UILabel(frame: CGRectMake(0.0, CGFloat(index * 50 + 5), 320.0, 40.0))
colorStripe.backgroundColor = UIColor(red: CGFloat(rgbTuple.red) / 255.0, green: CGFloat(rgbTuple.green) / 255.0, blue: CGFloat(rgbTuple.blue)/255.0, alpha: 1.0)
colorStripe
var colorNameLable = UILabel(frame: CGRectMake(0.0, 0.0, 300.0, 40.0))
colorNameLable.font = UIFont(name: "Arial", size: 24.0)
colorNameLable.textColor = UIColor.blackColor()
colorNameLable.textAlignment = NSTextAlignment.Right
colorNameLable.text = colorName
colorStripe.addSubview(colorNameLable)
backView.addSubview(colorStripe)
index++
}
backView
-
0赞 · 2采集
-
-
2012还是1984
2015-07-07
- import UIKit
let colors = [
"Air Force Blue":(red:93,green:138,blue:168),
"Bittersweet":(red:254,green:111,blue:94),
"Canary Yellow":(red:255,green:239,blue:0),
"Dark Orange":(red:255,green:140,blue:0),
"Electric Violet":(red:143,green:0,blue:255),
"Fern":(red:113,green:188,blue:120),
"Gamboge":(red:228,green:155,blue:15),
"Hollywood Cerise":(red:252,green:0,blue:161),
"Icterine":(red:252,green:247,blue:94),
"Jazzberry Jam":(red:165,green:11,blue:94)
]
var backView = UIView(frame:CGRectMake(0.0, 0.0, 320, CGFloat(colors.count * 50)))
backView.backgroundColor = UIColor.blackColor()
-
0赞 · 0采集
-
-
koc
2015-06-29
- 你以为autolayout是干什么的
-
0赞 · 0采集
-
-
beyonder1980
2015-06-08
- 对齐方式:colorNameLanel.textAlignment=NSTextAlignment.Right
-
0赞 · 0采集
-
-
beyonder1980
2015-06-08
- UIFont()字体
-
0赞 · 0采集
-
-
beyonder1980
2015-06-08
- 颜色:UIColor(),颜色值为小数(0..1)归一到255.
UILabel
CGRectMake()创建框架。
-
0赞 · 0采集
-
-
熊猫大仙
2015-06-08
- let colors =[ "Air Force Blue":(red:93,green:138,blue:168),"Bittersweet":(red:254,green:111,blue:94),"Canary Yellow":(red:255,green:239,blue:0),"Dark Orange":(red:255,green:140,blue:0),...]
var backView = UIView(frame:CGRectMake(0.0, 0.0, 320.0,CGFloat(colors.count*50)))
backView.backgroundColor = UIColor.blackColor()
var index = 0
for (colorName,rgbTuple) in colors{
var colorStripe = UILabel(frame:CGRectMake(0.0, CGFloat(index*50+5),320.0 , 40.0))
colorStripe.backgroundColor = UIColor(red: CGFloat(rgbTuple.red) / 255.0, green: CGFloat(rgbTuple.green) / 255.0, blue: CGFloat(rgbTuple.blue)/255.0, alpha: 1.0)
var colorNameLabel = UILabel(frame: CGRectMake(0.0, 0.0, 300.0, 40.0))
colorNameLabel.font = UIFont(name:"Arial",size:24.0)
colorNameLabel.textColor = UIColor.blackColor()
colorNameLabel.textAlignment = NSTextAlignment.Right
colorNameLabel.text = colorName
colorStripe.addSubview(colorNameLabel)
backView.addSubview(colorStripe)
index++
}
-
0赞 · 1采集
-
-
不辩是非
2015-04-23
- UIView(frame): 创建一个视图
CGRectMake(x,y,width,height): 创建一个矩形
CGFloat: 浮点值的基本类型
CGPoint: 表示一个二维坐标系中的点
CGSize: 表示一个矩形的宽度和高度
CGRect: 表示一个矩形的位置和大小
-
1赞 · 2采集
-
-
慕后端8796626
2015-04-18
- use Tuple & Dictionary
let color = [ "Gray" : (r:93,g:93,b:93) , "Red" : (r:250,g:0,b:0) ]
-
截图
0赞 · 0采集
-
-
Pepsi_Scofield
2015-04-11
- CGrect
-
截图
0赞 · 0采集
-
-
FlatMan
2015-04-02
- CGRect
-
截图
0赞 · 0采集
-
-
waple_0820
2015-03-25
- 试一遍
-
0赞 · 0采集
-
-
TickTock
2015-03-04
- 源代码2
===================
backview.backgroundColor = UIColor.blackColor()
var index = 0
for (colorName,rgbTuple) in colors{
var colorStripe = UILabel(frame: CGRectMake(0.0, CGFloat(index*50+5), 320.0, 40.0))
colorStripe.backgroundColor = UIColor(red: CGFloat(rgbTuple.red)/255.0, green: CGFloat(rgbTuple.green)/255.0, blue: CGFloat(rgbTuple.blue)/255.0, alpha: 1.0)
var colorNameLable = UILabel(frame: CGRectMake(0.0, 0.0, 300, 40))
colorNameLable.font = UIFont(name: "Arial", size: 24)
colorNameLable.textColor = UIColor.blackColor()
colorNameLable.textAlignment = NSTextAlignment.Right
colorNameLable.text = colorName
colorStripe.addSubview(colorNameLable)
backview.addSubview(colorStripe)
index++
}
backview
-
0赞 · 0采集
-
-
TickTock
2015-03-04
- 源代码 1
================
let colors = [
"Air Force Blue":(red:93,green:138,blue:168),
"Bittersweet":(red:254,green:111,blue:94),
"Canary Yellow":(red:255,green:239,blue:0),
"Dark Orange":(red:255,green:140,blue:0),
"Electric Violet":(red:143,green:0,blue:255),
"Fern":(red:113,green:188,blue:120),
"Gamboge":(red:228,green:155,blue:15),
"Hollywood Cerise":(red:252,green:0,blue:161),
"Icterine":(red:252,green:247,blue:94),
"Jazzberry Jam":(red:165,green:11,blue:94)
]
var backview = UIView(frame:CGRectMake(0.0, 0.0, 320.0, CGFloat(colors.count*50)))
-
0赞 · 0采集
-
-
小段段来了
2015-01-19
- 多练习。。。。
-
截图
0赞 · 0采集