Created
November 15, 2018 13:03
-
-
Save gmoraleda/82674fd1d88d3451240684478bdafe3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...] | |
// Add observer in layoutSubviews() | |
pictureImageView.observe(\UIImageView.frame, options: [.new]) { [weak self] (_, _) in | |
self?.updateTextViewFrame() | |
} | |
[...] | |
private func updateTextViewFrame() { | |
contentView.layoutIfNeeded() | |
let rect = pictureImageView.convert(pictureImageView.bounds, to: descriptionTextView) | |
let imagePath = UIBezierPath(rect: rect) | |
descriptionTextView.textContainer.exclusionPaths = [imagePath] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment