gpt4 book ai didi

arrays - 填充 UITableViewController

转载 作者:行者123 更新时间:2023-11-30 11:32:46 28 4
gpt4 key购买 nike

这是我将内容打印到表格 View 的代码

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCell(withIdentifier: "atmCell", for: indexPath)

cell.textLabel?.text = AtmList.instance.atms[indexPath.row].title
cell.detailTextLabel?.text = AtmList.instance.atms[indexPath.row].subtitle
cell.imageView?.setImage = "Icon\(([indexPath.row] as! String)").imgPoi



return cell
}

我想使用打印在表格 View 上的标题来与 Assets 中保存图像的名称进行比较,并相应地填充表格 View 。

这是 View Controller 的图像。 view image

最佳答案

     position = place.coordinate

//Adding icons to maps as atm pinpoints
if place.name[place.name.startIndex] == "W" {
icon = UIImage(named: "wemaBank_pin")// takes a Character or a literal
}else if place.name[place.name.startIndex] == "A" {
icon = UIImage(named: "AccessBank_pin")
}else if place.name[place.name.startIndex] == "C" {
icon = UIImage(named: "CitiBank_pin")
}else if place.name[place.name.startIndex] == "D" {
icon = UIImage(named: "DiamondBank_pin")
}else if place.name[place.name.startIndex] == "H" {
icon = UIImage(named: "HeritageBank_Pin")
}else if place.name[place.name.startIndex] == "P" {
icon = UIImage(named: "ProvidusBank_pin")
} else if place.name[place.name.startIndex] == "F" && place.name[place.name.index(place.name.startIndex, offsetBy: 2)] == "D" {
icon = UIImage(named: "FidelityBank_pin")
}else if place.name[place.name.startIndex] == "F" && place.name[place.name.index(after: place.name.startIndex)] == "C" {
icon = UIImage(named: "FCMB_pin")
} else if place.name[place.name.startIndex] == "F" && place.name[place.name.index(place.name.startIndex, offsetBy: 5)] == "C" {
icon = UIImage(named: "FCMB_pin")
} else if place.name[place.name.startIndex] == "U" && place.name[place.name.index(place.name.startIndex, offsetBy: 3)] == "o" {
icon = UIImage(named: "UnionBank_pin")
}else if place.name[place.name.startIndex] == "G" {
icon = UIImage(named: "GTBank_pin")
}else if place.name[place.name.startIndex] == "G" && place.name[place.name.index(place.name.startIndex, offsetBy: 1)] == "U" {
icon = UIImage(named: "GTBank_pin")
}else if place.name[place.name.startIndex] == "F" {
icon = UIImage(named: "FirstBank_pin")
}else if place.name[place.name.startIndex] == "K" {
icon = UIImage(named: "KeystoneBank_pin")
}else if place.name[place.name.startIndex] == "S" && place.name[place.name.index(place.name.startIndex, offsetBy: 2)] == "y" {
icon = UIImage(named: "skyeBank_pin")
}else if place.name[place.name.startIndex] == "E" {
icon = UIImage(named: "ecoBank_pin")
}else if place.name[place.name.startIndex] == "Z" {
icon = UIImage(named: "ZenithBank_pin")
}else if place.name[place.name.startIndex] == "U" &&

groundAnchor = CGPoint(x: 0.5, y: 1)
appearAnimation = .pop
}
}

关于arrays - 填充 UITableViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50085305/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com