Skip to content

Commit

Permalink
Enabling delayed animated content views.
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Kluz committed Sep 27, 2015
1 parent 9868bce commit 2ad496c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Demo/DemoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ class DemoViewController: UIViewController {
@IBAction func showAnimatedProgressHUD(sender: AnyObject) {
PKHUD.sharedHUD.contentView = PKHUDProgressView()
PKHUD.sharedHUD.show()
PKHUD.sharedHUD.hide(afterDelay: 2.0)

let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(2.0 * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) {
PKHUD.sharedHUD.contentView = PKHUDSuccessView()
PKHUD.sharedHUD.hide(afterDelay: 2.0)
}
}

@IBAction func showTextHUD(sender: AnyObject) {
Expand Down
2 changes: 1 addition & 1 deletion PKHUD.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = 'PKHUD'
s.module_name = 'PKHUD'
s.version = '2.2.0'
s.version = 2.2.1
s.summary = 'A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8'
s.homepage = 'https://github.com/pkluz/PKHUD'
s.license = 'MIT'
Expand Down
4 changes: 4 additions & 0 deletions PKHUD/PKHUD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public class PKHUD: NSObject {
}
set {
window.frameView.content = newValue
if !window.hidden && contentView.conformsToProtocol(PKHUDAnimating) {
let animatingContentView = contentView as! PKHUDAnimating
animatingContentView.startAnimation()
}
}
}

Expand Down

0 comments on commit 2ad496c

Please sign in to comment.