From 581b0964535c5aa17cea7be664138e2a1f5dbab6 Mon Sep 17 00:00:00 2001 From: Tomohiro Mitsumune Date: Thu, 17 Mar 2016 16:27:39 +0900 Subject: [PATCH] Adjust preferredContentSize using customView by HUDProgressViewController --- HUDKit/Classes/Progress/HUDProgressViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/HUDKit/Classes/Progress/HUDProgressViewController.swift b/HUDKit/Classes/Progress/HUDProgressViewController.swift index 1d54280..283a365 100644 --- a/HUDKit/Classes/Progress/HUDProgressViewController.swift +++ b/HUDKit/Classes/Progress/HUDProgressViewController.swift @@ -75,7 +75,12 @@ public class HUDProgressViewController: UIViewController { self.customView = customView self.status = status - preferredContentSize = CGSizeMake(100.0, 100.0) + if let customView = customView { + let insets = UIEdgeInsets(top: -30, left: -30, bottom: -30, right: -30) + preferredContentSize = UIEdgeInsetsInsetRect(customView.bounds, insets).size + } else { + preferredContentSize = CGSizeMake(100.0, 100.0) + } modalPresentationStyle = .Custom transitioningDelegate = self