Use NSData - init(contentsOfFile)
This commit is contained in:
parent
f07f4267e2
commit
a2df318b5e
|
@ -50,8 +50,12 @@ 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)
|
||||||
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? {
|
class func imageWithData(data: NSData, delegate: UIImageView?) -> Self? {
|
||||||
|
|
Loading…
Reference in New Issue