You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's how i did it. I created a view controller with a textview. And on save action or delegate method of textview, computed the size of the text in the textview.
Here's the code snippet if somebody needs.
let font = UIFont.systemFont(ofSize: 16)
let fontAttributes = [NSAttributedString.Key.font: font]
let myText = textView.text
let textsize = (myText! as NSString).size(withAttributes: fontAttributes)
let size = CGSize(width: textsize.width+10, height: self.textView.contentSize.height+10)
UIGraphicsBeginImageContextWithOptions(size, false, 0);
self.textView.drawHierarchy(in: CGRect(x: 0, y: 0, width: self.textView.frame.size.width, height: self.textView.frame.size.height),afterScreenUpdates:true)
let screenShot:UIImage = UIGraphicsGetImageFromCurrentImageContext() ?? UIImage()
consider the resultant screenshot below.
This will give you an image with a screenshot of the text. Then you can create a charlet/texture out of this image (For this you can take help from the sampel code.)
How to add text to the canvas, like in the Liang's brush App in the app store.
The text was updated successfully, but these errors were encountered: