From 02e72cbac6ed9e545232f2703f205c38b2c69399 Mon Sep 17 00:00:00 2001 From: krimpedance Date: Fri, 3 Mar 2017 17:11:45 +0900 Subject: [PATCH] Add style to which the background can be changed --- DEMO/KRProgressHUDDemo/Info.plist | 2 +- KRProgressHUD.podspec | 2 +- .../KRActivityIndicatorViewStyle.swift | 12 +- KRProgressHUD/Classes/KRProgressHUD.swift | 222 ++++++++++-------- .../Classes/KRProgressHUDExtensions.swift | 2 +- KRProgressHUD/Info.plist | 2 +- README.md | 12 +- README_Ja.md | 17 +- 8 files changed, 138 insertions(+), 133 deletions(-) diff --git a/DEMO/KRProgressHUDDemo/Info.plist b/DEMO/KRProgressHUDDemo/Info.plist index 6539bf2..197cf9e 100644 --- a/DEMO/KRProgressHUDDemo/Info.plist +++ b/DEMO/KRProgressHUDDemo/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.1.0 + 2.2.0 CFBundleSignature ???? CFBundleVersion diff --git a/KRProgressHUD.podspec b/KRProgressHUD.podspec index d832edd..b3dc860 100644 --- a/KRProgressHUD.podspec +++ b/KRProgressHUD.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "KRProgressHUD" - s.version = "2.1.0" + s.version = "2.2.0" s.summary = "A beautiful progress HUD for your iOS." s.description = "KRProgressHUD is a beautiful and easy-to-use HUD meant to display the progress on iOS." s.homepage = "https://github.com/krimpedance/KRProgressHUD" diff --git a/KRProgressHUD/Classes/KRActivityIndicatorView/KRActivityIndicatorViewStyle.swift b/KRProgressHUD/Classes/KRActivityIndicatorView/KRActivityIndicatorViewStyle.swift index a43abfa..ead117d 100644 --- a/KRProgressHUD/Classes/KRActivityIndicatorView/KRActivityIndicatorViewStyle.swift +++ b/KRProgressHUD/Classes/KRActivityIndicatorView/KRActivityIndicatorViewStyle.swift @@ -11,15 +11,15 @@ import UIKit KRActivityIndicatorView's style - Normal size(20x20) - - **Black:** the color is a gradation to `.lightGrayColor()` from `.blackColor()`. - - **White:** the color is a gradation to `UIColor(white: 0.7, alpha:1)` from `.whiteColor()`. - - **Color(startColor, endColor):** the color is a gradation to `endColor` from `startColor`. + - **black:** the color is a gradation to `.lightGray` from `.black`. + - **white:** the color is a gradation to `UIColor(white: 0.7, alpha:1)` from `.white`. + - **color(startColor, endColor):** the color is a gradation to `endColor` from `startColor`. - Large size(50x50) - - **LargeBlack:** the color is same `.Black`. - - **LargeWhite:** the color is same `.White`. - - **LargeColor(startColor, endColor):** the color is same `.Color()`. + - **largeBlack:** the color is same `.black`. + - **largeWhite:** the color is same `.white`. + - **largeColor(startColor, endColor):** the color is same `.color()`. */ public enum KRActivityIndicatorViewStyle { case black, white, color(UIColor, UIColor?) diff --git a/KRProgressHUD/Classes/KRProgressHUD.swift b/KRProgressHUD/Classes/KRProgressHUD.swift index 98ff652..9b7c357 100644 --- a/KRProgressHUD/Classes/KRProgressHUD.swift +++ b/KRProgressHUD/Classes/KRProgressHUD.swift @@ -10,9 +10,9 @@ import UIKit /** Type of KRProgressHUD's background view. - - **Clear:** `UIColor.clearColor`. - - **White:** `UIColor(white: 1, alpho: 0.2)`. - - **Black:** `UIColor(white: 0, alpho: 0.2)`. Default type. + - **clear:** `UIColor.clear`. + - **white:** `UIColor(white: 1, alpho: 0.2)`. + - **black:** `UIColor(white: 0, alpho: 0.2)`. Default type. */ public enum KRProgressHUDMaskType { case clear, white, black @@ -21,21 +21,22 @@ public enum KRProgressHUDMaskType { /** Style of KRProgressHUD. - - **Black:** HUD's backgroundColor is `.blackColor()`. HUD's text color is `.whiteColor()`. - - **White:** HUD's backgroundColor is `.whiteColor()`. HUD's text color is `.blackColor()`. Default style. - - **BlackColor:** same `.Black` and confirmation glyphs become original color. - - **WhiteColor:** same `.Black` and confirmation glyphs become original color. + - **black:** HUD's backgroundColor is `.black`. HUD's text color is `.white`. + - **white:** HUD's backgroundColor is `.white`. HUD's text color is `.black`. Default style. + - **blackColor:** same `.black` and confirmation glyphs become original color. + - **whiteColor:** same `.black` and confirmation glyphs become original color. + - **color(background, contents):** Set custom color of HUD's background and contents(text, glyph icon). */ public enum KRProgressHUDStyle { - case black, white, blackColor, whiteColor + case black, white, blackColor, whiteColor, color(background: UIColor, contents: UIColor) } /** KRActivityIndicatorView style. (KRProgressHUD uses only large style.) - - **Black:** the color is `.blackColor()`. Default style. - - **White:** the color is `.blackColor()`. - - **Color(startColor, endColor):** the color is a gradation to `endColor` from `startColor`. + - **black:** the color is `.black`. Default style. + - **white:** the color is `.black`. + - **color(startColor, endColor):** the color is a gradation to `endColor` from `startColor`. */ public enum KRProgressHUDActivityIndicatorStyle { case black, white, color(UIColor, UIColor) @@ -46,8 +47,7 @@ public enum KRProgressHUDActivityIndicatorStyle { * KRProgressHUD is a beautiful and easy-to-use progress HUD. */ public final class KRProgressHUD { - fileprivate static let view = KRProgressHUD() - class func sharedView() -> KRProgressHUD { return view } + fileprivate static let sharedView = KRProgressHUD() fileprivate let window = UIWindow(frame: UIScreen.main.bounds) fileprivate let progressHUDView = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) @@ -59,49 +59,33 @@ public final class KRProgressHUD { fileprivate var tmpWindow: UIWindow? fileprivate var maskType: KRProgressHUDMaskType { - willSet { - switch newValue { - case .clear: window.rootViewController?.view.backgroundColor = UIColor.clear - case .white: window.rootViewController?.view.backgroundColor = UIColor(white: 1, alpha: 0.2) - case .black: window.rootViewController?.view.backgroundColor = UIColor(white: 0, alpha: 0.2) - } - } + didSet { updatedMaskType() } } - fileprivate var progressHUDStyle: KRProgressHUDStyle { - willSet { - switch newValue { - case .black, .blackColor: - progressHUDView.backgroundColor = UIColor.black - messageLabel.textColor = UIColor.white - case .white, .whiteColor: - progressHUDView.backgroundColor = UIColor.white - messageLabel.textColor = UIColor.black - } - } + didSet { updatedProgressHUDStyle() } } fileprivate var activityIndicatorStyle: KRProgressHUDActivityIndicatorStyle { - willSet { - switch newValue { - case .black: activityIndicatorView.activityIndicatorViewStyle = .largeBlack - case .white: activityIndicatorView.activityIndicatorViewStyle = .largeWhite - case let .color(sc, ec): activityIndicatorView.activityIndicatorViewStyle = .largeColor(sc, ec) - } - } + didSet { updatedActivityIndicatorStyle() } + } + + fileprivate var defaultMaskType = KRProgressHUDMaskType.black { + willSet { maskType = newValue } + } + fileprivate var defaultStyle = KRProgressHUDStyle.white { + willSet { progressHUDStyle = newValue } + } + fileprivate var defaultActivityIndicatorStyle = KRProgressHUDActivityIndicatorStyle.black { + willSet { activityIndicatorStyle = newValue } + } + fileprivate var defaultMessageFont = UIFont.systemFont(ofSize: 13) { + willSet { messageLabel.font = newValue } } - fileprivate var defaultStyle: KRProgressHUDStyle = .white { willSet { progressHUDStyle = newValue } } - fileprivate var defaultMaskType: KRProgressHUDMaskType = .black { willSet { maskType = newValue } } - fileprivate var defaultActivityIndicatorStyle: KRProgressHUDActivityIndicatorStyle = .black { willSet { activityIndicatorStyle = newValue } } - fileprivate var defaultMessageFont = UIFont.systemFont(ofSize: 13) { willSet { messageLabel.font = newValue } } - fileprivate var defaultPosition: CGPoint = { - let screenFrame = UIScreen.main.bounds - return CGPoint(x: screenFrame.width/2, y: screenFrame.height/2) - }() { + fileprivate var defaultPosition = CGPoint(x: UIScreen.main.bounds.width/2, y: UIScreen.main.bounds.height/2) { willSet { progressHUDView.center = newValue } } public static var isVisible: Bool { - return sharedView().window.alpha == 0 ? false : true + return sharedView.window.alpha == 0 ? false : true } @@ -111,33 +95,68 @@ public final class KRProgressHUD { activityIndicatorStyle = .black configureProgressHUDView() } +} + + +/** + * Private Actions -------------------------- + */ +fileprivate extension KRProgressHUD { + func updatedMaskType() { + switch maskType { + case .clear: window.rootViewController?.view.backgroundColor = .clear + case .white: window.rootViewController?.view.backgroundColor = UIColor(white: 1, alpha: 0.2) + case .black: window.rootViewController?.view.backgroundColor = UIColor(white: 0, alpha: 0.2) + } + } + + func updatedProgressHUDStyle() { + switch progressHUDStyle { + case .black, .blackColor: + progressHUDView.backgroundColor = .black + messageLabel.textColor = .white + case .white, .whiteColor: + progressHUDView.backgroundColor = .white + messageLabel.textColor = .black + case let .color(background, text): + progressHUDView.backgroundColor = background + messageLabel.textColor = text + } + } + func updatedActivityIndicatorStyle() { + switch activityIndicatorStyle { + case .black: activityIndicatorView.activityIndicatorViewStyle = .largeBlack + case .white: activityIndicatorView.activityIndicatorViewStyle = .largeWhite + case let .color(sc, ec): activityIndicatorView.activityIndicatorViewStyle = .largeColor(sc, ec) + } + } - fileprivate func configureProgressHUDView() { + func configureProgressHUDView() { let rootViewController = KRProgressHUDViewController() window.rootViewController = rootViewController window.windowLevel = UIWindowLevelNormal window.alpha = 0 progressHUDView.center = defaultPosition - progressHUDView.backgroundColor = UIColor.white + progressHUDView.backgroundColor = .white progressHUDView.layer.cornerRadius = 10 progressHUDView.autoresizingMask = [.flexibleBottomMargin, .flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin] window.rootViewController?.view.addSubview(progressHUDView) - iconView.backgroundColor = UIColor.clear + iconView.backgroundColor = .clear iconView.center = CGPoint(x: 50, y: 50) progressHUDView.addSubview(iconView) activityIndicatorView.isHidden = false iconView.addSubview(activityIndicatorView) - drawView.backgroundColor = UIColor.clear + drawView.backgroundColor = .clear drawView.isHidden = true iconView.addSubview(drawView) messageLabel.center = CGPoint(x: 150/2, y: 90) - messageLabel.backgroundColor = UIColor.clear + messageLabel.backgroundColor = .clear messageLabel.font = defaultMessageFont messageLabel.textAlignment = .center messageLabel.adjustsFontSizeToFitWidth = true @@ -156,31 +175,31 @@ extension KRProgressHUD { /// Set default mask type. /// - parameter type: `KRProgressHUDMaskType` public class func set(maskType type: KRProgressHUDMaskType) { - KRProgressHUD.sharedView().defaultMaskType = type + KRProgressHUD.sharedView.defaultMaskType = type } /// Set default HUD style /// - parameter style: `KRProgressHUDStyle` public class func set(style: KRProgressHUDStyle) { - KRProgressHUD.sharedView().defaultStyle = style + KRProgressHUD.sharedView.defaultStyle = style } /// Set default KRActivityIndicatorView style. /// - parameter style: `KRProgresHUDActivityIndicatorStyle` public class func set(activityIndicatorStyle style: KRProgressHUDActivityIndicatorStyle) { - KRProgressHUD.sharedView().defaultActivityIndicatorStyle = style + KRProgressHUD.sharedView.defaultActivityIndicatorStyle = style } /// Set default HUD text font. /// - parameter font: text font public class func set(font: UIFont) { - KRProgressHUD.sharedView().defaultMessageFont = font + KRProgressHUD.sharedView.defaultMessageFont = font } /// Set default HUD center's position. /// - parameter position: center position public class func set(centerPosition position: CGPoint) { - KRProgressHUD.sharedView().defaultPosition = position + KRProgressHUD.sharedView.defaultPosition = position } } @@ -210,10 +229,10 @@ extension KRProgressHUD { font: UIFont? = nil, message: String? = nil, image: UIImage? = nil, completion: (()->())? = nil ) { - KRProgressHUD.sharedView().updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: indicatorStyle) - KRProgressHUD.sharedView().updateProgressHUDViewText(font: font, message: message) - KRProgressHUD.sharedView().updateProgressHUDViewIcon(image: image) - KRProgressHUD.sharedView().show() { completion?() } + KRProgressHUD.sharedView.updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: indicatorStyle) + KRProgressHUD.sharedView.updateProgressHUDViewText(font: font, message: message) + KRProgressHUD.sharedView.updateProgressHUDViewIcon(image: image) + KRProgressHUD.sharedView.show() { completion?() } } /** @@ -232,12 +251,12 @@ extension KRProgressHUD { centerPosition position: CGPoint? = nil, progressHUDStyle progressStyle: KRProgressHUDStyle? = nil, maskType type: KRProgressHUDMaskType? = nil) { - KRProgressHUD.sharedView().progressHUDView.center = position ?? KRProgressHUD.sharedView().defaultPosition - KRProgressHUD.sharedView().updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) - KRProgressHUD.sharedView().updateProgressHUDViewText(font: font, message: message, onlyText: true) - KRProgressHUD.sharedView().updateProgressHUDViewIcon(onlyText: true) - KRProgressHUD.sharedView().show() - Thread.afterDelay(2.0) { + KRProgressHUD.sharedView.progressHUDView.center = position ?? KRProgressHUD.sharedView.defaultPosition + KRProgressHUD.sharedView.updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) + KRProgressHUD.sharedView.updateProgressHUDViewText(font: font, message: message, onlyText: true) + KRProgressHUD.sharedView.updateProgressHUDViewIcon(onlyText: true) + KRProgressHUD.sharedView.show() + DispatchQueue.afterDelay(2.0) { KRProgressHUD.dismiss() } } @@ -256,11 +275,11 @@ extension KRProgressHUD { progressHUDStyle progressStyle: KRProgressHUDStyle? = nil, maskType type: KRProgressHUDMaskType? = nil, font: UIFont? = nil, message: String? = nil) { - KRProgressHUD.sharedView().updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) - KRProgressHUD.sharedView().updateProgressHUDViewText(font: font, message: message) - KRProgressHUD.sharedView().updateProgressHUDViewIcon(iconType: .success) - KRProgressHUD.sharedView().show() - Thread.afterDelay(1.0) { + KRProgressHUD.sharedView.updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) + KRProgressHUD.sharedView.updateProgressHUDViewText(font: font, message: message) + KRProgressHUD.sharedView.updateProgressHUDViewIcon(iconType: .success) + KRProgressHUD.sharedView.show() + DispatchQueue.afterDelay(1.0) { KRProgressHUD.dismiss() } } @@ -279,12 +298,12 @@ extension KRProgressHUD { progressHUDStyle progressStyle: KRProgressHUDStyle? = nil, maskType type: KRProgressHUDMaskType? = nil, font: UIFont? = nil, message: String? = nil) { - KRProgressHUD.sharedView().updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) - KRProgressHUD.sharedView().updateProgressHUDViewText(font: font, message: message) - KRProgressHUD.sharedView().updateProgressHUDViewIcon(iconType: .info) - KRProgressHUD.sharedView().show() + KRProgressHUD.sharedView.updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) + KRProgressHUD.sharedView.updateProgressHUDViewText(font: font, message: message) + KRProgressHUD.sharedView.updateProgressHUDViewIcon(iconType: .info) + KRProgressHUD.sharedView.show() - Thread.afterDelay(1.0) { + DispatchQueue.afterDelay(1.0) { KRProgressHUD.dismiss() } } @@ -303,12 +322,12 @@ extension KRProgressHUD { progressHUDStyle progressStyle: KRProgressHUDStyle? = nil, maskType type: KRProgressHUDMaskType? = nil, font: UIFont? = nil, message: String? = nil) { - KRProgressHUD.sharedView().updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) - KRProgressHUD.sharedView().updateProgressHUDViewText(font: font, message: message) - KRProgressHUD.sharedView().updateProgressHUDViewIcon(iconType: .warning) - KRProgressHUD.sharedView().show() + KRProgressHUD.sharedView.updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) + KRProgressHUD.sharedView.updateProgressHUDViewText(font: font, message: message) + KRProgressHUD.sharedView.updateProgressHUDViewIcon(iconType: .warning) + KRProgressHUD.sharedView.show() - Thread.afterDelay(1.0) { + DispatchQueue.afterDelay(1.0) { KRProgressHUD.dismiss() } } @@ -327,12 +346,12 @@ extension KRProgressHUD { progressHUDStyle progressStyle: KRProgressHUDStyle? = nil, maskType type: KRProgressHUDMaskType? = nil, font: UIFont? = nil, message: String? = nil) { - KRProgressHUD.sharedView().updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) - KRProgressHUD.sharedView().updateProgressHUDViewText(font: font, message: message) - KRProgressHUD.sharedView().updateProgressHUDViewIcon(iconType: .error) - KRProgressHUD.sharedView().show() + KRProgressHUD.sharedView.updateStyles(progressHUDStyle: progressStyle, maskType: type, activityIndicatorStyle: nil) + KRProgressHUD.sharedView.updateProgressHUDViewText(font: font, message: message) + KRProgressHUD.sharedView.updateProgressHUDViewIcon(iconType: .error) + KRProgressHUD.sharedView.show() - Thread.afterDelay(1.0) { + DispatchQueue.afterDelay(1.0) { KRProgressHUD.dismiss() } } @@ -347,15 +366,15 @@ extension KRProgressHUD { public class func dismiss(_ completion: (()->())? = nil) { DispatchQueue.main.async { () -> Void in UIView.animate(withDuration: 0.5, animations: { - KRProgressHUD.sharedView().window.alpha = 0 + KRProgressHUD.sharedView.window.alpha = 0 }, completion: { _ in - KRProgressHUD.sharedView().window.isHidden = true - KRProgressHUD.sharedView().tmpWindow?.makeKey() - KRProgressHUD.sharedView().activityIndicatorView.stopAnimating() - KRProgressHUD.sharedView().progressHUDStyle = KRProgressHUD.sharedView().defaultStyle - KRProgressHUD.sharedView().maskType = KRProgressHUD.sharedView().defaultMaskType - KRProgressHUD.sharedView().activityIndicatorStyle = KRProgressHUD.sharedView().defaultActivityIndicatorStyle - KRProgressHUD.sharedView().messageLabel.font = KRProgressHUD.sharedView().defaultMessageFont + KRProgressHUD.sharedView.window.isHidden = true + KRProgressHUD.sharedView.tmpWindow?.makeKey() + KRProgressHUD.sharedView.activityIndicatorView.stopAnimating() + KRProgressHUD.sharedView.progressHUDStyle = KRProgressHUD.sharedView.defaultStyle + KRProgressHUD.sharedView.maskType = KRProgressHUD.sharedView.defaultMaskType + KRProgressHUD.sharedView.activityIndicatorStyle = KRProgressHUD.sharedView.defaultActivityIndicatorStyle + KRProgressHUD.sharedView.messageLabel.font = KRProgressHUD.sharedView.defaultMessageFont completion?() }) @@ -369,7 +388,7 @@ extension KRProgressHUD { */ extension KRProgressHUD { public class func update(text: String) { - sharedView().messageLabel.text = text + sharedView.messageLabel.text = text } } @@ -385,7 +404,7 @@ private extension KRProgressHUD { self.window.makeKeyAndVisible() UIView.animate(withDuration: 0.5, animations: { - KRProgressHUD.sharedView().window.alpha = 1 + KRProgressHUD.sharedView.window.alpha = 1 }, completion: { _ in completion?() }) @@ -394,13 +413,13 @@ private extension KRProgressHUD { func updateStyles(progressHUDStyle progressStyle: KRProgressHUDStyle?, maskType type: KRProgressHUDMaskType?, activityIndicatorStyle indicatorStyle: KRProgressHUDActivityIndicatorStyle?) { if let style = progressStyle { - KRProgressHUD.sharedView().progressHUDStyle = style + KRProgressHUD.sharedView.progressHUDStyle = style } if let type = type { - KRProgressHUD.sharedView().maskType = type + KRProgressHUD.sharedView.maskType = type } if let style = indicatorStyle { - KRProgressHUD.sharedView().activityIndicatorStyle = style + KRProgressHUD.sharedView.activityIndicatorStyle = style } } @@ -460,7 +479,7 @@ private extension KRProgressHUD { case let (nil, image): drawView.isHidden = false let imageView = UIImageView(image: image) - imageView.frame = KRProgressHUD.sharedView().drawView.bounds + imageView.frame = KRProgressHUD.sharedView.drawView.bounds imageView.contentMode = .scaleAspectFit drawView.addSubview(imageView) @@ -475,6 +494,7 @@ private extension KRProgressHUD { switch progressHUDStyle { case .black: pathLayer.fillColor = UIColor.white.cgColor case .white: pathLayer.fillColor = UIColor.black.cgColor + case let .color(_, icon): pathLayer.fillColor = icon.cgColor default: pathLayer.fillColor = type!.getColor() } diff --git a/KRProgressHUD/Classes/KRProgressHUDExtensions.swift b/KRProgressHUD/Classes/KRProgressHUDExtensions.swift index e39d658..2f82b8e 100644 --- a/KRProgressHUD/Classes/KRProgressHUDExtensions.swift +++ b/KRProgressHUD/Classes/KRProgressHUDExtensions.swift @@ -26,7 +26,7 @@ extension UIApplication { } } -extension Thread { +extension DispatchQueue { static func afterDelay(_ delayTime: Double, completion: @escaping () -> Void) { let when = DispatchTime.now() + delayTime DispatchQueue.global().asyncAfter(deadline: when, execute: completion) diff --git a/KRProgressHUD/Info.plist b/KRProgressHUD/Info.plist index dca568e..a60ea4a 100644 --- a/KRProgressHUD/Info.plist +++ b/KRProgressHUD/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.1.0 + 2.2.0 CFBundleSignature ???? CFBundleVersion diff --git a/README.md b/README.md index db9c992..a7960c7 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,9 @@ ## Requirements -#### ver. 2.\* (current branch) - iOS 9.0+ - Xcode 8.0+ -- Swift 3.\* - -#### ver. 1.\*(1.7.0 and over) -- iOS 8.0+ -- Xcode 8.0+ -- Swift 2.3.\* +- Swift 3.0+ ## DEMO To run the example project, clone the repo, and open `KRProgressHUDDemo.xcodeproj` from the DEMO directory. @@ -54,7 +48,6 @@ github "Krimpedance/KRProgressHUD" **If you want to use it with other cases (ex. pull to refresh), I suggest using [KRActivityIndicatorView](https://github.com/krimpedance/KRActivityIndicator).** - `KRProgressHUD` is created as a singleton. At first, import `KRProgressHUD` in your swift file. @@ -149,9 +142,10 @@ public class func set(centerPosition: CGPoint) // Default is center of device s ## Contributing to this project I'm seeking bug reports and feature requests. -(And please teach me if my English is wrong :| ) ## Release Note +- 2.2.0 : Add `KRProgressHUDStyle.color(background: UIColor, contents: UIColor)`. + This can set custom color of HUD's background and contents(text, glyph icon). - 2.1.0 : Add function to which indicate HUD with only message. Default font was changed to system font. - 2.0.0 : Corresponding to Swift3. diff --git a/README_Ja.md b/README_Ja.md index bbaf27e..8e405f7 100644 --- a/README_Ja.md +++ b/README_Ja.md @@ -20,20 +20,9 @@ ## 必要環境 -#### ver. 2.\*系 (現在のバージョン) - iOS 9.0+ - Xcode 8.0+ -- Swift 3.\* - -#### ver. 1.\*系(1.7.0以上) -- iOS 8.0+ -- Xcode 8.0+ -- Swift 2.3.\* - -#### ver. 1.\*系(1.7.0未満) -- iOS 8.0+ -- Xcode 7.\* -- Swift 2.2.\* +- Swift 3.0+ ## デモ `DEMO/`以下にあるサンプルプロジェクトから確認してください. @@ -62,7 +51,7 @@ github "Krimpedance/KRProgressHUD" **PullRefreshなど,他の場面で使用したい場合は,[KRActivityIndicatorView](https://github.com/krimpedance/KRActivityIndicator)を使用することをお勧めします** -   + `KRProgressHUD`はシングルトンパターンで作られています. まず,`KRProgressHUD`をインポートします. @@ -155,6 +144,8 @@ public class func set(centerPosition: CGPoint) // デフォルト: デバイス バグや機能のリクエストがありましたら,気軽にコメントしてください. ## リリースノート +- 2.2.0 : `KRProgressHUDStyle.color(background: UIColor, contents: UIColor)` を追加しました. + このスタイルを用いることで, HUDの背景, コンテンツ(テキスト, アイコン)の色をカスタマイズできます. - 2.1.0 : テキストだけのHUDを表示する機能を追加. 標準フォントをシステムフォントに変更しました. - 2.0.0 : Swift3に対応