Closed forTJ555 closed 4 years ago
Hi,
Images stretched means change image view content property mode to aspect fit.
Regards, Boominadha Prakash
but from where do i get image property from stories view
Hi @forTJ555 Kindly look at IGStoryPreviewCell and line number: 172. There is a method called createSnapView(). Here you can get the respective individual image view. Try to change the AspectFit for this image view and let us know
Thanks, Ranjith
yes it works perfectly now, thanks for your help @ranmyfriend
is there any way to make background white? i was set background color of image to black but it did not work @ranmyfriend
@forTJ555 See the image is there in scrollView and scrollView is there in IGStoryPreviewCell. try to change the background colour of the cell. Like cell.contentView and see or try to change it to scroll view background colour.
@ranmyfriend both are not work neither scroll view backround nor cell.content view background color
Hmm. Actually the image view is completely stretched to scroll view. that's why even if we set a different colour to the content view and scroll view also not reflecting.
is there any other way to make to black?
@forTJ555 instead of giving the ImageView.height equal to scroll view.height. you just try to give image.size.height but it should not be exceed with scroll view.height. once you apply this logic, then your scroll view area will get visible automatically. then you just set the background colour of scroll view. By then Automatically it will get visible. or try to set the image height in 9:16 Aspect Ratio. I hope it will work. Let me know once you have fixed it.
snapView.heightAnchor.constraint(equalTo: snapView.heightAnchor),
did this and set scroll view background color black. but its not working well
See you should update the Height Anchor constant with Image size.height. Once you get downloaded requested image, get the size of the image and set it to the Height Anchor of snapView. then it will work.
Hi @forTJ555
If you want to set any backgroundColor, apply backgroundColor where we are creating the views. For example if you want to set background color for ScrollView, set background color for ScrollView which we are generating on IGStoryPreviewCell.
Please attach any sample screenshot of how do you want to display the image. So that we can guide you in better way.
Regards, Boominadha Prakash
background shows white when image set as scaleAspectFit snapView.contentMode = .scaleAspectFit
@forTJ555 Have you tried to set background color for cell?
I found solution Set background color in IGImageRequestable extension after set image
I found solution to get average color of image, and set it to background solution here https://www.hackingwithswift.com/example-code/media/how-to-read-the-average-color-of-a-uiimage-using-ciareaaverage It looks beautiful
@fadeev-vitaliy You are awesome :) Thanks.
@forTJ555 can you please try to implement what he mentioned and let us know.
yes it works perfect. Thanks for the great library :)
Hi @forTJ555
Glad to hear that your issue has been resolved.
Regards, Boominadha Prakash
Describe the bug when we upload images and show it from url using api's it looks stretched how we can fix this?