Post

Replies

Boosts

Views

Activity

Reply to Using UIPreviewParameters with textLineRects on a UITextView
The workaround I came up with for this is taking the text line rects, generating a UIBezierPath that exactly wraps around all of them while containing nothing extra. I then use this path in a CAShapeLayer that I assign to the snapshot view's layer.mask property. Unfortunately, this doesn't quite work as it seems using UIPreviewParameters(textLineRects:) causes the preview view's mask to be silently ignored. So, I embed the snapshot view into a separate container and pass that as the view parameter to UITargetedPreview. See FB7832297 for more information about this issue.
Jul ’20
Reply to Using UIPreviewParameters with textLineRects on a UITextView
As far as I can tell, the only different properties between the two text views are the text view's own font and the text container's lineFragmentPadding. Setting both of those on the duplicated text view to their values from the original one does not affect the layout of the text in the preview animation. Using a snapshot of the original text view as the preview's view mostly works, however in some cases when the link text wraps across multiple lines, the text from right before the link is still partially visible in the preview animation, presumably because such a wide margin is added around the textLineRects (I would post an image of this, but...).
Jun ’20