Krishna Kumar Krishna Kumar - 10 days ago 5
Objective-C Question

How to add a overlay text on captured video/image in swift?

I want to add a overlay text like "Company watermark" on captured video or image programatically in swift. any help will be appreciated.

Answer

// create text Layer

let titleLayer = CATextLayer()
titleLayer.backgroundColor = UIColor.whiteColor().CGColor
titleLayer.string = "Company watermark"
titleLayer.font = UIFont(name: "Helvetica", size: 28)
titleLayer.shadowOpacity = 0.5
titleLayer.alignmentMode = kCAAlignmentCenter
titleLayer.frame = CGRectMake(0, 50, size.width, size.height / 6)
yourView.layer.addSublayer(titleLayer)

Hope it will help you for adding text in video.