我有陣[["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'等..生成計數段作爲主數組中的數組計數 –