亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

代碼報錯的進,希望能幫到你

import UIKit


let colors =

[

? ? "A":(red:93,green:138,blue:168),

? ? "B":(red:254,green:111,blue:94),

? ? "C":(red:255,green:239,blue:0),

? ? "D":(red:255,green:140,blue:0),

? ? "E":(red:143,green:0,blue:255),

? ? "F":(red:113,green:188,blue:120),

? ? "G":(red:228,green:155,blue:15),

? ? "H":(red:244,green:0,blue:161),

? ? "I":(red:252,green:247,blue:94),

? ? "J":(red:165,green:11,blue:94)

]

var backView=UIView(frame:CGRect(x: 0.0, y: 0.0, width: 320.0, height: Double(colors.count * 50)))

backView.backgroundColor=UIColor.black

backView

var index=0

for (colorName,rgbTuble) in colors

{

? ? var colorStripe=UILabel(frame:CGRect(x: 0.0, y: Double(index*50+5), width: 320.0, height: 40.0))

? ? colorStripe.backgroundColor =

? ? ? ? UIColor(

? ? ? ? ? ? red: CGFloat(rgbTuble.red)/255.0,

? ? ? ? ? ? green: CGFloat(rgbTuble.green)/255.0,

? ? ? ? ? ? blue: CGFloat(rgbTuble.blue)/255.0,

? ? ? ? ? ? alpha: 1.0

? ? )

? ? var colorNameLabel=UILabel(frame: CGRect(x: 0.0, y: 0.0, width: 300.0, height: 40.0))

? ? colorNameLabel.font = UIFont(name:"Arial", size: 24.0)

? ? colorNameLabel.textColor = UIColor.black

? ? colorNameLabel.textAlignment = NSTextAlignment.right

? ? colorNameLabel.text = colorName

? ? colorStripe.addSubview(colorNameLabel)

? ? backView.addSubview(colorStripe)

? ? index+=1

}

backView


UIColor.black 現在是一個屬性值,不是方法

CGRectMake() - > CGRect()


https://img1.sycdn.imooc.com//5b74f7700001151703440519.jpg


正在回答

舉報

0/150
提交
取消

代碼報錯的進,希望能幫到你

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號