-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use uiimageview as header title #28
Comments
you can use it in CollapsibleTableViewHeader class, just replace your arrowLabel with something similar to code below; // Arrow Image View |
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: