Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何使用颜色数组中的数据(Swift)_Ios_Swift_Swift4 - Fatal编程技术网

Ios 如何使用颜色数组中的数据(Swift)

Ios 如何使用颜色数组中的数据(Swift),ios,swift,swift4,Ios,Swift,Swift4,我使用委托将数据发送回VC 我传递数据和文本文件,但我还需要从数组发送数据 如何使用数组中的数据(CardColor:(colorraytwo))试试下面的代码 更改此代码 protocol AddDelegate { func AddCard(CompanyName: String, CardColor: [UIColor]) } for Data in ColorArrayTwo { lbltitle.textColor = Data } ======OR==== lb

我使用委托将数据发送回VC

我传递数据和文本文件,但我还需要从数组发送数据

如何使用数组中的数据(CardColor:(colorraytwo))试试下面的代码 更改此代码

protocol AddDelegate {
    func AddCard(CompanyName: String, CardColor: [UIColor])
}

for Data in ColorArrayTwo {
    lbltitle.textColor = Data
}

======OR====

lbltitle.textColor = ColorArrayTwo[1]

在ColorArrayTwo中传递索引。就像ColorArrayTwo{}@IOS中的数据一样,我怎么做?我真的不知道您想在哪里使用此代码?我通过self.delegate?.AddCard发送数据(CompanyName:“(CNField.text!)”,CardColor:(ColorArrayTwo))只需添加AddCard方法代码。方法中有CardColor和CompanyName吗?第二个解决方案很有帮助,我使用了ColorArrayTwo[0]
protocol AddDelegate {
    func AddCard(CompanyName: String, CardColor: UIColor)
}
protocol AddDelegate {
    func AddCard(CompanyName: String, CardColor: [UIColor])
}

for Data in ColorArrayTwo {
    lbltitle.textColor = Data
}

======OR====

lbltitle.textColor = ColorArrayTwo[1]