SnapshotSafeView
SnapshotSafeView copied to clipboard
How I can apply this to any View from storyboard?
I added one UIView in UIViewController (Please check the screenshot below) Once a user tries to take a screenshot, that View should not appear in the screenshot. How I can do it? How I can apply your library/code to any specific view (UIView) ?
I tried the following code, from that code my View itself not showing in iPhone, once I run the code.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var safeView1: UIView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
var hiddenFromScreenshotButtonController2 = ScreenshotProtectController(content: safeView1)
hiddenFromScreenshotButtonController2.setupContentAsHiddenInScreenshotMode()
}
}
Hi, @MallikarjunH, you should apply all layout operations to container. https://github.com/Stampoo/SnapshotSafeView#uikit
var hiddenFromScreenshotButtonController2 = ScreenshotProtectController(content: safeView1)
hiddenFromScreenshotButtonController2.setupContentAsHiddenInScreenshotMode()
view.addSubview(hiddenFromScreenshotButtonController2.container) // U should adding container to view
[
hiddenFromScreenshotButtonController2.container.topAnchor.constraint(equalTo: view.topAnchor, constant: 65),
hiddenFromScreenshotButtonController2.container.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 65),
hiddenFromScreenshotButtonController2.container.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -65),
hiddenFromScreenshotButtonController2.container.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -65)
].forEach { $0.isActive = true } // Layout control apply to container