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
Click to enlarge the Image Content? #13
Comments
currently I embedded the Lightbox framework to it, but wonder if Carbon can provide a native method for it. 🤔 |
Hi @yo1995 , Carbon, like frameworks such as IGListKit, doesn't support complex features other than rendering list elements. final class CustomImageView: UIImageView {
var onPreview: ((UIImage) -> Void)?
override func awakeFromNib() {
super.awakeFromNib()
let gesture = UITapGestureRecognizer(target: self, action: #selector(handlePreview))
addGestureRecognizer(gesture)
isUserInteractionEnabled = true
}
@objc func handlePreview() {
guard let image = image else { return }
onPreview?(image)
}
}
struct ImageComponent: Component {
var image: UIImage
var onPreview: (UIImage) -> Void
func renderContent() -> CustomImageView {
return UIImageView()
}
func render(in content: CustomImageView) {
content.image = image
content.onPreview = onPreview
}
}
let component = ImageComponent(image: yourImage, onPreview: { image in
// Implement UIImage previewing
}) |
Thanks for your clarification! Got it. |
Checklist
Expected Behavior
Would you like to add a tap gesture or so, so that when tapping on imageview content, the image view will zoom in or pop up in a larger view to preview?
The text was updated successfully, but these errors were encountered: