标签:style blog color ar for sp div on log
// Playground - noun: a place where people can play import UIKit var str = "Hello, playground" // color与=号之间必须有个空格 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,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, 40)) colorStripe.backgroundColor=UIColor( red:CGFloat(rgbTuple.red), green:CGFloat(rgbTuple.green) , blue:CGFloat(rgbTuple.blue), alpha: 1.0 ) colorStripe var colorNameLabel=UILabel(frame: CGRectMake(0.0, 0.0,300, 40)) colorNameLabel.font=UIFont(name:"Arial", size: 24.0) colorNameLabel.textColor=UIColor.blackColor() colorNameLabel.text=colorName colorStripe.addSubview(colorNameLabel) backView.addSubview(colorStripe) index++ } backView var newbBackView=UIView(frame: CGRectMake(0,CGFloat(colors.count*5),320, CGFloat(colors.count*50))) newbBackView.backgroundColor=UIColor.orangeColor() index=0 for(colorName,rgbTuple) in colors { var colorStripe=UILabel(frame: CGRectMake(0,CGFloat(index*50+5), 320, 40)) colorStripe.backgroundColor=UIColor(red: CGFloat(rgbTuple.red), green: CGFloat(rgbTuple.green), blue: CGFloat(rgbTuple.blue), alpha: 0.5) colorStripe.text=colorName colorStripe.textAlignment=NSTextAlignment.Center index++ newbBackView.addSubview(colorStripe) } newbBackView
标签:style blog color ar for sp div on log
原文地址:http://www.cnblogs.com/lovelifeloveme/p/4066382.html