You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I modified example data so it contains: public var name: String public var imageURL: String public var items: [Item]
I can get imageURL string within this function: func collapsibleTableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { return sections[section].imageURL }
but when I change it to return uiimage, it cannot show any image from assets even I already put that image inside assets with same name like imageURL string.
this is my code: private func collapsibleTableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> UIImage? { let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 40, height: 20)) imageView.contentMode = .scaleAspectFit let image = UIImage(named: "\(sections[section].imageURL)") imageView.image = image return imageView.image }
How to show image within header title in section?
The text was updated successfully, but these errors were encountered:
I modified example data so it contains:
public var name: String public var imageURL: String public var items: [Item]
I can get imageURL string within this function:
func collapsibleTableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { return sections[section].imageURL }
but when I change it to return uiimage, it cannot show any image from assets even I already put that image inside assets with same name like imageURL string.
this is my code:
private func collapsibleTableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> UIImage? { let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 40, height: 20)) imageView.contentMode = .scaleAspectFit let image = UIImage(named: "\(sections[section].imageURL)") imageView.image = image return imageView.image }
How to show image within header title in section?
The text was updated successfully, but these errors were encountered: