parent
a2df318b5e
commit
4a3816c75f
|
@ -50,11 +50,11 @@ class AnimatedImage: UIImage {
|
||||||
// MARK: - Factories
|
// MARK: - Factories
|
||||||
class func imageWithName(name: String, delegate: UIImageView?) -> Self? {
|
class func imageWithName(name: String, delegate: UIImageView?) -> Self? {
|
||||||
let path = NSBundle.mainBundle().bundlePath.stringByAppendingPathComponent(name)
|
let path = NSBundle.mainBundle().bundlePath.stringByAppendingPathComponent(name)
|
||||||
|
|
||||||
if let data = NSData(contentsOfFile: path) {
|
if let data = NSData(contentsOfFile: path) {
|
||||||
return imageWithData(data, delegate: delegate)
|
return imageWithData(data, delegate: delegate)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,13 @@ func CGImageSourceGIFFrameDuration(imageSource: CGImageSource, index: Int) -> NS
|
||||||
|
|
||||||
var duration = 0.0
|
var duration = 0.0
|
||||||
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, UInt(index), nil) as NSDictionary
|
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, UInt(index), nil) as NSDictionary
|
||||||
let GIFProperties: NSDictionary? = imageProperties[kCGImagePropertyGIFDictionary] as? NSDictionary
|
let GIFProperties: NSDictionary? = imageProperties.objectForKey(kCGImagePropertyGIFDictionary) as? NSDictionary
|
||||||
|
|
||||||
if let properties = GIFProperties {
|
if let properties = GIFProperties {
|
||||||
duration = properties[kCGImagePropertyGIFUnclampedDelayTime] as Double
|
duration = properties.valueForKey(kCGImagePropertyGIFUnclampedDelayTime) as Double
|
||||||
|
|
||||||
if duration <= 0 {
|
if duration <= 0 {
|
||||||
duration = properties[kCGImagePropertyGIFDelayTime] as Double
|
duration = properties.valueForKey(kCGImagePropertyGIFDelayTime) as Double
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue