这可能是一个新手的错误和问题,但下面的代码有什么问题?
class CustomCell: UITableViewCell {
@IBOutlet weak var TitleLabel: UILabel!
@IBOutlet weak var ImageView: UIImageView!
@IBOutlet weak var NumbersView: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func customInit(text: String, numbersText: String, photo: UIImage) {
self.TitleLabel.text = text
self.NumbersView.text = text
self.ImageView.photo = UIImage)
}
}
我正在关注一个名为“SegmentedControl - Switch'Custom'TableViews:Swift 3”的教程,并且用户使用了以下代码:func customInit(text:String,accessoryText:String但我将其更改为包含UIImage但我不知道那是正确还是需要。
答案 0 :(得分:2)
应该是这样的:
self.ImageView.image = photo
self.NumbersView.text = numbersText