Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResizeImage is Jerking #2279

Open
nickp4488 opened this issue Aug 23, 2024 · 3 comments
Open

ResizeImage is Jerking #2279

nickp4488 opened this issue Aug 23, 2024 · 3 comments

Comments

@nickp4488
Copy link

resizeImage.jerk.mov

Hello,
I am using resize image processor to resize image as per screen width and pre-defined maxHeight.
It is working fine. but image is shown before resize and then jerks after resize.

My code:

img.kf.indicatorType = .activity
img.kf.setImage(with: url, placeholder: nil,
                    options: [
                        .transition(.fade(0.5)),
                        .processor(ResizingImageProcessor(referenceSize: CGSize(width: img.frame.width, height: 300),
                                                          mode: .aspectFit))])

Can you please correct me if I am doing anything wrong.

@onevcat
Copy link
Owner

onevcat commented Aug 24, 2024

Hi, @nickp4488

Based on the code you provided, it shouldn’t cause the issue you’re describing. However, I recommend checking if the setImage method is being called multiple times, possibly with different values for img.frame.width.

If that’s the case, please ensure that the setImage is called at the correct timing. If the image size depends on the current view hierarchy, make sure to set the image after the layout has completed to obtain the correct width.

@nickp4488
Copy link
Author

Hello @onevcat
I am reloading cell manually after a second,
If I stop reloading cell then image is shown as ssail origional without resizing.
After reload cell, resize image will show.

@nickp4488
Copy link
Author

Hi, @nickp4488

Based on the code you provided, it shouldn’t cause the issue you’re describing. However, I recommend checking if the setImage method is being called multiple times, possibly with different values for img.frame.width.

If that’s the case, please ensure that the setImage is called at the correct timing. If the image size depends on the current view hierarchy, make sure to set the image after the layout has completed to obtain the correct width.

can you please check this issue if possible?
thank you,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants