Use NSDictionary - value/objectForKey

- Closes #3, #4
This commit is contained in:
delba 2014-11-07 01:04:34 +01:00 committed by Reda Lemeden
parent a2df318b5e
commit 4a3816c75f
2 changed files with 6 additions and 6 deletions

View File

@ -50,11 +50,11 @@ class AnimatedImage: UIImage {
// MARK: - Factories
class func imageWithName(name: String, delegate: UIImageView?) -> Self? {
let path = NSBundle.mainBundle().bundlePath.stringByAppendingPathComponent(name)
if let data = NSData(contentsOfFile: path) {
return imageWithData(data, delegate: delegate)
return imageWithData(data, delegate: delegate)
}
return nil
}

View File

@ -14,13 +14,13 @@ func CGImageSourceGIFFrameDuration(imageSource: CGImageSource, index: Int) -> NS
var duration = 0.0
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 {
duration = properties[kCGImagePropertyGIFUnclampedDelayTime] as Double
duration = properties.valueForKey(kCGImagePropertyGIFUnclampedDelayTime) as Double
if duration <= 0 {
duration = properties[kCGImagePropertyGIFDelayTime] as Double
duration = properties.valueForKey(kCGImagePropertyGIFDelayTime) as Double
}
}