small logic cleaning
This commit is contained in:
parent
a7f9104bd8
commit
086378608d
@ -137,13 +137,13 @@ import UIKit
|
|||||||
// load new image if the width is different
|
// load new image if the width is different
|
||||||
if let oldWidth = self.width, let newWidth = width, !MVMCoreGetterUtility.cgfequal(oldWidth, newWidth) {
|
if let oldWidth = self.width, let newWidth = width, !MVMCoreGetterUtility.cgfequal(oldWidth, newWidth) {
|
||||||
return true
|
return true
|
||||||
} else if (self.width != nil && width == nil) || (self.width == nil && width != nil) {
|
} else if (self.width == nil) != (width == nil) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// load new image if the height is different
|
// load new image if the height is different
|
||||||
if let oldHeight = self.height, let newHeight = height, !MVMCoreGetterUtility.cgfequal(oldHeight, newHeight) {
|
if let oldHeight = self.height, let newHeight = height, !MVMCoreGetterUtility.cgfequal(oldHeight, newHeight) {
|
||||||
return true
|
return true
|
||||||
} else if (self.height != nil && height == nil) || (self.height == nil && height != nil) {
|
} else if (self.height == nil) || (height == nil) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -195,15 +195,7 @@ import UIKit
|
|||||||
if let imageName = json?.optionalStringForKey("image"), shouldLoadImage(withName: imageName, width: width, height: height) {
|
if let imageName = json?.optionalStringForKey("image"), shouldLoadImage(withName: imageName, width: width, height: height) {
|
||||||
imageView.image = nil
|
imageView.image = nil
|
||||||
imageView.animatedImage = nil
|
imageView.animatedImage = nil
|
||||||
var widthNumber: NSNumber?
|
loadImage(withName: imageName, format: json?.optionalStringForKey("imageFormat"), width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: json?.optionalStringForKey("fallbackImage"))
|
||||||
if let width = width {
|
|
||||||
widthNumber = NSNumber(value: Double(width))
|
|
||||||
}
|
|
||||||
var heightNumber: NSNumber?
|
|
||||||
if let height = height {
|
|
||||||
heightNumber = NSNumber(value: Double(height))
|
|
||||||
}
|
|
||||||
loadImage(withName: imageName, format: json?.optionalStringForKey("imageFormat"), width: widthNumber, height: heightNumber, customFallbackImage: json?.optionalStringForKey("fallbackImage"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user