diff --git a/LICENSE b/LICENSE index f1e037c..09b4bd4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) <2015> +Copyright (c) <2015-2016> wenhanlv@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index deb64ea..265eea8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ SwiftNotice is a GUI library for displaying various popups (HUD) written in pure ##Pretty easy to use -In any subclass of UIViewController: +In any subclass of UIView, UIScrollView, UIViewController, UITableViewController, UITableViewCell: ```swift self.pleaseWait() @@ -33,8 +33,10 @@ Just clone and add `SwiftNotice.swift` to your project. ##Requirements * iOS 7.0+ + +* Xcode 8 (Swift 3) in current swift3 branch. +* Xcode 7 (Swift 2) in master branch * Xcode 6.3 (Swift 1.2) in [v3.1](https://github.com/johnlui/SwiftNotice/releases/tag/v3.1) -* Xcode 7 (Swift 2.0) in the current master branch ##Contribution diff --git a/SwiftNotice.swift b/SwiftNotice.swift index 4641c21..1767f5e 100644 --- a/SwiftNotice.swift +++ b/SwiftNotice.swift @@ -9,7 +9,7 @@ import Foundation import UIKit -extension UIViewController { +extension UIResponder { /// wait with your own animated images func pleaseWaitWithImages(_ imageNames: Array, timeInterval: Int) { SwiftNotice.wait(imageNames, timeInterval: timeInterval) @@ -106,8 +106,6 @@ class SwiftNotice: NSObject { window.windowLevel = UIWindowLevelStatusBar window.isHidden = false - // change orientation - window.transform = CGAffineTransform(rotationAngle: CGFloat(degree * M_PI / 180)) window.addSubview(view) windows.append(window) @@ -130,8 +128,8 @@ class SwiftNotice: NSObject { iv.image = imageNames.first! iv.contentMode = UIViewContentMode.scaleAspectFit mainView.addSubview(iv) - timer = DispatchSource.makeTimerSource(flags: DispatchSource.TimerFlags(rawValue: UInt(0)), queue: DispatchQueue.main) /*Migrator FIXME: Use DispatchSourceTimer to avoid the cast*/ as! DispatchSource - timer.scheduleRepeating(deadline: DispatchTime.now(), interval: DispatchTimeInterval.nanoseconds(timeInterval)) + timer = DispatchSource.makeTimerSource(flags: DispatchSource.TimerFlags(rawValue: UInt(0)), queue: DispatchQueue.main) as! DispatchSource + timer.scheduleRepeating(deadline: DispatchTime.now(), interval: DispatchTimeInterval.milliseconds(timeInterval)) timer.setEventHandler(handler: { () -> Void in let name = imageNames[timerTimes % imageNames.count] iv.image = name diff --git a/SwiftNoticeExample/SwiftNoticeExample.xcodeproj/project.xcworkspace/xcuserdata/JohnLui.xcuserdatad/UserInterfaceState.xcuserstate b/SwiftNoticeExample/SwiftNoticeExample.xcodeproj/project.xcworkspace/xcuserdata/JohnLui.xcuserdatad/UserInterfaceState.xcuserstate index f443014..d38f247 100644 Binary files a/SwiftNoticeExample/SwiftNoticeExample.xcodeproj/project.xcworkspace/xcuserdata/JohnLui.xcuserdatad/UserInterfaceState.xcuserstate and b/SwiftNoticeExample/SwiftNoticeExample.xcodeproj/project.xcworkspace/xcuserdata/JohnLui.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SwiftNoticeExample/SwiftNoticeExample/ViewController.swift b/SwiftNoticeExample/SwiftNoticeExample/ViewController.swift index d67f9f6..5c59327 100644 --- a/SwiftNoticeExample/SwiftNoticeExample/ViewController.swift +++ b/SwiftNoticeExample/SwiftNoticeExample/ViewController.swift @@ -12,20 +12,20 @@ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - // Do any additional setup after loading the view, typically from a nib. -// UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. } @IBAction func topNotice(_ sender: AnyObject) { - self.noticeTop("OK!", autoClear: false) + UIApplication.shared.setStatusBarHidden(false, with: .slide) + self.noticeTop("OK!") } @IBAction func wait(_ sender: AnyObject) { -// self.pleaseWait() + // Just wait + // self.pleaseWait() + var imagesArray = Array() for i in 1...7 { imagesArray.append(UIImage(named: "loading\(i)")!)