ipraba / EPSignature

Signature component for iOS in Swift
MIT License
797 stars 206 forks source link

Crop around signature #10

Closed arr00 closed 8 years ago

arr00 commented 8 years ago

Is there any way to crop the UIImage around the signature? Right now I end up with a large UIImage that is mostly empty. Thanks

ipraba commented 8 years ago

@arr00 boundingRect value of this delegate below will return you the bounding rect of the signature drawn. func epSignature(_: EPSignature.EPSignatureViewController, didSigned signatureImage: UIImage, boundingRect: CGRect)

arr00 commented 8 years ago

Oh wow, can't believe I missed that. Thanks so much! Also, thanks for this repo, it is very useful for an app that I am currently developing.

Just in case anyone wondering though here is wondering what the actual code to crop the image is, I'll post it bellow.

let imageRef = CGImageCreateWithImageInRect(signatureImage.CGImage, boundingRect)