Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在出口集合中添加了一些选择器视图,它们应该具有不同的属性,我需要将它们添加到它们的 didset 例如,这里是出口集合
@IBOutlet var dataPickers: [UIPickerView]! { didset { } }
问题是,我不得不说,如果第一个成员dataPickers做那件事,但我不知道我怎么能在 didset 中这么说。
dataPickers
有人可以帮我吗?太感谢了
设置整个didSet数组时调用。如果您只想将属性应用于数组中的第一个选择器,那么您可以执行以下操作:
didSet
@IBOutlet var dataPickers: [UIPickerView]! { didSet { if let first = dataPickers.first { first.someProperty = someValue } } }