Use NSData - init(contentsOfFile)

This commit is contained in:
delba 2014-11-07 01:03:03 +01:00
parent f07f4267e2
commit a2df318b5e
1 changed files with 6 additions and 2 deletions

View File

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