0
我新的iOS開發&只是有問題的填充在從單一dictionary.here不同部分的數據是我的字典從單一的詞典填充tableview中的不同部分在斯威夫特
var menuItems = [["city":"Lahore","cityimage":"2","country":"Pakistan"],["city":"istanbul","cityimage":"3","country":"Turkey"],["city":"Moscow","cityimage":"4","country":"Russia"],["city":"Riyadh","cityimage":"5","country":"KSA"]]
這裏是我的功能該作品罰款多行的單節的問題是我不知道如何在這個
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell=tableView.dequeueReusableCell(withIdentifier: "TableCell", for:indexPath) as! TableCellTry
cell.lblCityName.text!=menuItems[indexPath.row]["city"]!
cell.lblProvince.text!=menuItems[indexPath.row]["country"]!
cell.imgCity.image=UIImage(named:menuItems[indexPath.row]["cityimage"]!)
訪問它們的哪些元素應該是在節#0和第1號? –
#0節中的前2個城市#1節中的最後2個節點 –
然後@ Michael的[answer](https://stackoverflow.com/a/46219619/6536841)是正確的。 –