-1

I want to implement a story(Image and videos) like the Instagram and WhatsApp application. Features like the add text on image and video with the customize font and color. Please see the below image for the reference

enter image description here

Is there any idea? I have referred following like for Add text on the image but not much help.

Ilesh P
  • 3,940
  • 1
  • 24
  • 49

2 Answers2

0

Try this:

let imagePlaceholder = "[ImagePlaceholder]"
let fullString = String(format: "Hello %@", imagePlaceholder)
let attributes: [NSAttributedStringKey: Any] = [.font: UIFont.systemFont(ofSize: 16), .foregroundColor: UIColor.white]
let attributedString = NSMutableAttributedString(string: fullString, attributes: attributes)

if let imagePlaceholderRange = fullString.range(of: imagePlaceholder) {
    let range = NSRange(imagePlaceholderRange, in: fullString)
    let attachment = NSTextAttachment()
    let myImage = UIImage(named: "MyImage")
    attachment.image = myImage

    let stringAttachment = NSAttributedString(attachment: attachment)
    attributedString.replaceCharacters(in: range, with: stringAttachment)
}
myLabel.attributedText = attributedString
Sunil Chauhan
  • 2,074
  • 1
  • 15
  • 33
-2

You need to add in css or any phostoshop

if it is css means you need wotk opacity:0.5 add div on image add the text