简体   繁体   中英

Exporting a UIView to a png on iOS

I have 100's of images that I need to format on a UIView. I need to be able to access screenshots of these images remotely so I figure the most convenient way is to prerender them as .png's and just upload them directly. They won't be unique for each user so no point having each user upload there own, that could get ugly quickly.

Can anybody tell me how I could go about doing this in a Mac or iOS application?

I'm currently using UIGraphicsGetImageFromCurrentImageContext to create a png in memory but I have no idea how to physically save it as a file that exists outside the application.

Use UIImagePNGRepresentation to get the data from the UIImage . Then use writeToFile:atomically: to save the data to disk or NSURLConnection to send the data to a web service.

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