I'm working on a Swift iOS app where I want the user to be able to place an image (a sticker such as a beard or an eyepatch) over another image.
Currently I have it working to where they can take a photo or pull an image up from their Photos and have that display in a UIImage. Obviously next is adding the sticker. I've been able to dig up zero data on this from Google or Stack. And I mean zero.
Does anyone have a general idea of how I would execute this? Specifics would help too of course.
Fotor is a free online photo editor that lets you easily add stickers to photos. Just upload your picture and you can immediately start decorating it with stickers. There're tons of stickers available on Fotor. Choose stickers you like and drag them to your photos.
To add a sticker to your photo, just slide to pick your pack, tap to open the game or app to see the stickers, and slide up to view them all if there are several. Tap to stick one on your photo, move it where you like, close the sticker window, and hit the capture button.
Here's the easy way.
UIView
as a parent, let's say stickerView
stickerView
stickerView
stickerView
Here's the code to snapshot UIView
,
extension UIImage {
class func imageWithView(view: UIView) -> UIImage {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0)
view.drawViewHierarchyInRect(view.bounds, afterScreenUpdates: true)
let img = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return img
}
}
Usage
let snapshotImage = UIImage.imageWithView(stickerView)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With