Fix intrinsic size bug

- Animated image class always returned `CGRectZero` as intrinsic content size
- Fixes #7
This commit is contained in:
Reda Lemeden 2014-12-21 10:32:07 +00:00
parent b87464f542
commit c51f0f7cbd
1 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,10 @@ public class AnimatedImage: UIImage {
var animatedFrames = [AnimatedFrame]() var animatedFrames = [AnimatedFrame]()
var totalDuration: NSTimeInterval = 0.0 var totalDuration: NSTimeInterval = 0.0
override public var size: CGSize {
return frameAtIndex(0)?.size ?? CGSizeZero
}
// MARK: - Private Properties // MARK: - Private Properties
private lazy var displayLink: CADisplayLink = CADisplayLink(target: self, selector: "updateCurrentFrame") private lazy var displayLink: CADisplayLink = CADisplayLink(target: self, selector: "updateCurrentFrame")
private var currentFrameIndex = 0 private var currentFrameIndex = 0