From a8cd0e9817f3cff93fd9be359c5dac3bb2cbbf4b Mon Sep 17 00:00:00 2001 From: Mani Ramezan Date: Sun, 26 Apr 2020 00:11:55 -0400 Subject: [PATCH 1/2] Add .DS_Store to .ignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 89c1750..f7a8b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ Pods/ # Add this line if you want to avoid checking in source code from Carthage dependencies. Carthage/Checkouts Carthage/Build + +.DS_Store From 765ec32b8e2eedd6464fc513808ea93f6217490a Mon Sep 17 00:00:00 2001 From: Mani Ramezan Date: Sun, 26 Apr 2020 00:16:10 -0400 Subject: [PATCH 2/2] Change the way ratioLabel size is calculated Current method truncates the ratio text --- .../Progress/Core/ProgressAtRatioView.swift | 7 ++++++- source/Progress/Core/ProgressAtRatioView.swift | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/GCProgressSample/GradientCircularProgress/Progress/Core/ProgressAtRatioView.swift b/GCProgressSample/GradientCircularProgress/Progress/Core/ProgressAtRatioView.swift index 9b2367d..3d74a85 100644 --- a/GCProgressSample/GradientCircularProgress/Progress/Core/ProgressAtRatioView.swift +++ b/GCProgressSample/GradientCircularProgress/Progress/Core/ProgressAtRatioView.swift @@ -104,8 +104,13 @@ class ProgressAtRatioView: UIView { ratioLabel.font = prop.ratioLabelFont ratioLabel.textAlignment = NSTextAlignment.right ratioLabel.textColor = prop.ratioLabelFontColor - ratioLabel.sizeToFit() + ratioLabel.frame.size = (ratioLabel.text as! NSString).boundingRect( + with: CGSize(width: prop.progressSize, height: CGFloat.infinity), + options: .usesLineFragmentOrigin, + attributes: [.font: ratioLabel.font], + context: nil).size ratioLabel.center = center + ratioLabel.adjustsFontSizeToFitWidth = true addSubview(ratioLabel) } diff --git a/source/Progress/Core/ProgressAtRatioView.swift b/source/Progress/Core/ProgressAtRatioView.swift index 9b2367d..3d74a85 100644 --- a/source/Progress/Core/ProgressAtRatioView.swift +++ b/source/Progress/Core/ProgressAtRatioView.swift @@ -104,8 +104,13 @@ class ProgressAtRatioView: UIView { ratioLabel.font = prop.ratioLabelFont ratioLabel.textAlignment = NSTextAlignment.right ratioLabel.textColor = prop.ratioLabelFontColor - ratioLabel.sizeToFit() + ratioLabel.frame.size = (ratioLabel.text as! NSString).boundingRect( + with: CGSize(width: prop.progressSize, height: CGFloat.infinity), + options: .usesLineFragmentOrigin, + attributes: [.font: ratioLabel.font], + context: nil).size ratioLabel.center = center + ratioLabel.adjustsFontSizeToFitWidth = true addSubview(ratioLabel) }