From 782ec788ae34553bf6b104be0b8a91d1a940b29d Mon Sep 17 00:00:00 2001 From: FutureSonic Date: Mon, 15 Feb 2021 11:09:14 +0000 Subject: [PATCH 1/2] fix calculation of arc for drawBubbleRightShape --- Sources/EasyTipView/EasyTipView.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/EasyTipView/EasyTipView.swift b/Sources/EasyTipView/EasyTipView.swift index 3d3e1be..dfd5cff 100644 --- a/Sources/EasyTipView/EasyTipView.swift +++ b/Sources/EasyTipView/EasyTipView.swift @@ -616,8 +616,7 @@ open class EasyTipView: UIView { path.addArc(tangent1End: CGPoint(x: frame.x + frame.width, y: frame.y), tangent2End: CGPoint(x: frame.x, y: frame.y), radius: cornerRadius) path.addArc(tangent1End: CGPoint(x: frame.x, y: frame.y), tangent2End: CGPoint(x: frame.x, y: frame.y + frame.height), radius: cornerRadius) path.addArc(tangent1End: CGPoint(x: frame.x, y: frame.y + frame.height), tangent2End: CGPoint(x: frame.x + frame.width, y: frame.y + frame.height), radius: cornerRadius) - path.addArc(tangent1End: CGPoint(x: frame.x + frame.width, y: frame.y + frame.height), tangent2End: CGPoint(x: frame.x + frame.width, y: frame.height), radius: cornerRadius) - + path.addArc(tangent1End: CGPoint(x: frame.x + frame.width, y: frame.y + frame.height), tangent2End: CGPoint(x: frame.x + frame.width, y: frame.y), radius: cornerRadius) } fileprivate func drawBubbleLeftShape(_ frame: CGRect, cornerRadius: CGFloat, path: CGMutablePath) { From fb2bd0c9105c9d8d5373c26017877df07a372f65 Mon Sep 17 00:00:00 2001 From: Chris McIntyre Date: Fri, 5 Mar 2021 15:24:19 -0600 Subject: [PATCH 2/2] fix misplaced view for pre-iOS 12 devices --- Sources/EasyTipView/EasyTipView.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/EasyTipView/EasyTipView.swift b/Sources/EasyTipView/EasyTipView.swift index dfd5cff..41347e9 100644 --- a/Sources/EasyTipView/EasyTipView.swift +++ b/Sources/EasyTipView/EasyTipView.swift @@ -533,7 +533,13 @@ open class EasyTipView: UIView { } if case .view(let contentView) = content { - contentView.translatesAutoresizingMaskIntoConstraints = false + // When using `.view(contentView)`, pre-iOS 12 devices will have displaced text (outside of the "bubble"). + // This ensures the view is within the bubble frame + if UIDevice.current.systemVersion.compare("12.0", options: String.CompareOptions.numeric) == ComparisonResult.orderedAscending { + contentView.translatesAutoresizingMaskIntoConstraints = true + } else { + contentView.translatesAutoresizingMaskIntoConstraints = false + } contentView.frame = getContentRect(from: getBubbleFrame()) }