YYImage icon indicating copy to clipboard operation
YYImage copied to clipboard

Method `calcMaxBufferCount` only calls one time?

Open wang9262 opened this issue 9 years ago • 0 comments

If the memory warning is not trigged, the method calcMaxBufferCount only called in imageChanged. Imagine this situation:

YYFrameImage *images = [[YYFrameImage alloc] initWithImagePaths:imagePaths oneFrameDuration:0.05 loopCount:10];
// 1
YYAnimatedImageView *indefiniteAnimatedView = [[YYAnimatedImageView alloc] initWithImage:images]; 
// 2
indefiniteAnimatedView.maxBufferSize = 5 * 1024 * 1024;

//1、This will make the method imageChanged and calcMaxBufferCount called, and the maxBufferSize is 0, So the _maxBufferCount is dynamically caculated.

// 2、After the imageChanged method called, setting the maxBufferSize does nothing, and the _maxBufferCount doesn't change, which means setting max buffer size after setting image will has no effect.

Maybe move the caculate method to startAnimating method is better?

wang9262 avatar Mar 31 '17 08:03 wang9262