我有阵[["PT"], ["GE", "DE", "PL", "BY"], ["CZ", "US"]]
,我想在UISegmentedControl
我编程方式创建使用它:转换阵列来段中迅速
for i in 0..<array.count {
mySegmentControl.insertSegment(withTitle: array[i], at: i, animated: false)
}
我看到错误:
Cannot convert value of type '[String]' to expected argument type 'String?'
这是真的,但我需要的PT
将在第一段标题,GE..BY
秒等
段标题是字符串,而不是数组。你期望什么结果?第二部分的标题应该是什么? –
@MartinR我知道,但如何做到这一点'PT'作为字符串将在第一个段,'第二个'GE..BY'等..生成计数段作为主数组中的数组计数 –