-
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查看全部
-
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()查看全部
-
stringByTrimmingCharactersInSet(NsCharacterSet.whitespaceCharacterSet(" "))) //去掉头尾相应字符 componentsSeparatedByString(" ") //以某个字符为标示分割字符串 join(["1","2","3"]) //把某个字符当做连接符连接字符串查看全部
-
String方法查看全部
-
老师,能做一组课程讲解如何做模型吗查看全部
-
dictionary查看全部
-
array type查看全部
-
playground查看全部
-
toint查看全部
-
区间运算符查看全部
-
nil查看全部
-
你以为autolayout是干什么的查看全部
-
Bridging, 与OC对接,类型转换,引用OC中的方法 var PI = "3.14" (PI as NSString).doubleValue var arr = [1,2,3] (arr as NSArray).indexOfObject(3) arr1 as? Array<String> //可选型,尝试转换类型查看全部
-
List 有序集合 Dictionary 键值集合 Set 无序集合 var set1 = Set<String>( ) set1.insert("element1") set1.count set1.isEmpty set1.remove("element1") A.intersect(B) A.union(B) A.subtract(B) A.exclusiveOr(B) 子集,父集 C.isSubsetOf(A) A.isSupersetOf(C) C.isStrictSubsetOf(A) A.isStrictSupersetOf(C) A.isDisjointWith([100,1000]) //集合是否相邻查看全部
-
swift 1.2 new features if-let , 应用Optional的参数,进行解包。 if let, let, let. //应用多个let进行多参数的解包,可以用where对 let的可选型变量进行限制; if let name = name where name == "angelbaby";查看全部
举报
0/150
提交
取消