简体   繁体   中英

Inserting An Image from UIImagepicker into UICollectionViewCell Swift

Hey just wondering if its possible to Select a specific image from the photolibrary and implement into a Collection View

so the idea is to have an image the user can select from the photolibrary then fill the selected image into a cell within the collection view i would also like to be able to save the image so if the user deletes the photo from the library it remains within the application ( was thinking i could save the image within firebase or NSUserdefaults?

A controller demonstrating how to select photos to display in a collection view can be found here .

If you're only going to be saving a single image, then putting it at a known path like demonstrated here would work: How to save a remote image with Swift?

If you're trying to manage multiple images, it's probably a good idea to look into Core Data and have it manage the images' UIImageJPEGRepresentation NSData for you. (Be sure to set "Store in External Record File" for the image data record if you do this!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM