Я установил свойство imageView в ячейке tableView. Я хочу изменить ширину и высоту изображения. Как я могу это сделать, не используя пользовательскую ячейку? Вот мой код:
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
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... -view-cell
Как установить размер imageView внутри ячейки табличного представления ⇐ IOS
Программируем под IOS
1737213226
Anonymous
Я установил свойство imageView в ячейке tableView. Я хочу изменить ширину и высоту изображения. Как я могу это сделать, не используя пользовательскую ячейку? Вот мой код:
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
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79367398/how-to-set-the-size-of-an-imageview-inside-table-view-cell[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия