伙计们,当我按下collectionView的颜色时,我必须更改TextField的颜色。我正在尝试使用此代码,但它不会改变任何内容。我在做什么错了?
sampleTextField插入视图“ labelV”
let sampleTextField = UITextField()
sampleTextField.attributedPlaceholder = NSAttributedString(string: "text",
attributes: [NSAttributedString.Key.foregroundColor: UIColor.white])
sampleTextField.textColor = UIColor.white
sampleTextField.autocorrectionType = UITextAutocorrectionType.no
sampleTextField.keyboardType = UIKeyboardType.default
sampleTextField.returnKeyType = UIReturnKeyType.done
sampleTextField.clearButtonMode = UITextField.ViewMode.whileEditing;
sampleTextField.contentVerticalAlignment = UIControl.ContentVerticalAlignment.center
sampleTextField.isUserInteractionEnabled = true
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
debugPrint("sucaaaa")
var cell = delegate2?.labelV.sampleTextField.textColor?.cgColor
cell = datasource[indexPath.item].color as! CGColor
}
var labelV: LabelView = LabelView(frame: .zero, name: "tipo")