CollectionView with image from camera - recommendation for best way to handle?

Hi,

I have an UICollecitonView that loads a placeholder image within a ColletionView cell without any problems. The placeholder image is loaded via ‘Assets’ using a string property.

I am also take a picture that I would like to place the placeholder image with the one taking via the camera. I know that the image from the camera is loading without any problems. Ideally, I would like to assign a string literal to the camera image then load it via UIImage, but not certain if it’s possible to get a string from the camera image? I also tried to save the image via pngData method and saving to the document directory with no luck.

Does anyone have any recommendations to handle this situation?

Thanks,

My issue is that I am not certain what’s the best approach to use the camera image with the CollectionView.

“Ideally, I would like to assign a string literal to the camera image then load it via UIImage, but not certain if it’s possible to get a string from the camera image?” :thinking: why?

you can keep a reference to the selected image and load the view with that

Iganti,

Thanks for the reply.

The reason that I was trying to use a string is because image is stored as part of a struct. Do you suggest having a reference to each image that I need to load?

well, you could have a collection of images and cache them if needed

I figured out what was going on. My mistake was that I was not setting the image correctly in the CollectionView Cell. And once I corrected my mistake, the camera picture showed up fine.

This topic was automatically closed after 166 days. New replies are no longer allowed.