So legen Sie die Größe einer Bildansicht in einer Tabellenansichtszelle fest

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: So legen Sie die Größe einer Bildansicht in einer Tabellenansichtszelle fest

by Guest » 18 Jan 2025, 18:52

Ich habe die imageView-Eigenschaft für eine tableView-Zelle festgelegt. Ich möchte die Breite und Höhe des Bildes ändern. Wie kann ich das tun, ohne eine benutzerdefinierte Zelle zu verwenden? Hier ist mein Code:

Code: Select all

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = options[stepIndex][indexPath.row]
cell.textLabel?.font = UIFont(name: "Inter-Regular", size: 18)

let iconImage = UIImage(named: optionIcons[stepIndex][indexPath.row])
if stepIndex == 0 {
cell.imageView?.sd_setImage(with: URL(string: optionIcons[stepIndex][indexPath.row]), placeholderImage: UIImage(named: "icon-history"))
} else {
cell.imageView?.image = iconImage
}
cell.imageView?.tintColor = .systemBlue

// Update checkbox state
if selectedOptions.contains(options[stepIndex][indexPath.row]) {
cell.accessoryType = .checkmark
} else {
cell.accessoryType = .none
}

return cell
}

Top