我有这样的代码,需要在同一代码中使用cmyk颜色而不是rgb颜色可以有人对此进行帮助

时间:2018-07-07 06:15:30

标签: io

func collectionView(_ collectionView:UICollectionView,cellForItemAt indexPath:IndexPath)-> UICollectionViewCell {         让cell = collectionView.dequeueReusableCell(withReuseIdentifier:“ cell”,for:indexPath)为! specialTopCollectionViewCell         cell.lblSpecialCategoryTop.text =(specialCategoryArray [indexPath.row] as!String)

    let myColor = UIColor(red:0.2, green: 0.8, blue: 0.8, alpha: 2)//Light Pink

    let myColor1 = UIColor(red:4, green: 0.8, blue: 0.8, alpha: 2)//Light Blue

    let myColor2 = UIColor(red:0.5, green: 0.8, blue: 2, alpha: 1)//Light Green

    let myColor3 = UIColor(red:0.1, green: 0.2, blue: 0.5, alpha: 0.5)//Light Lavender

    let myColor4 = UIColor(red:1, green: 0.9, blue: 0.5, alpha: 0.5)  //Light Yellow

    let myColor5 = UIColor(red:1, green: 0.8, blue: 0.6, alpha: 0.5)  //light Red

    let myColor6 = UIColor(red:0.7, green: 0.7, blue: 0.7, alpha: 0.5)  //light Red0.7/0.7/0.7

    let colorArray = [ myColor, myColor1, myColor2, myColor3, myColor4, myColor5,myColor6]

    // I changed this to randomIndex as it is an integer, not a color
    let randomIndex: Int = Int(arc4random_uniform(UInt32(colorArray.count)))

    // Now assign color at random index to your cell background color
    cell.backgroundColor = colorArray[randomIndex]

            return cell


}

0 个答案:

没有答案