Closed AMBE1203 closed 1 year ago
Yes. You can do that. I am attaching the sample code below. Anything in the YourSecureView will be secure also you can toggle the secure property of that view using the isSecure value.
class YourSecureView: UIView {
fileprivate let secureField = UITextField()
var isSecure: Bool = true {
didSet {
secureField.isSecureTextEntry = isSecure
}
}
override init(frame: CGRect) {
super.init(frame: frame)
commenInit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
commenInit()
}
fileprivate func commenInit() {
secureField.isSecureTextEntry = true
self.addSubview(secureField)
secureField.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
secureField.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
self.layer.superlayer?.addSublayer(secureField.layer)
secureField.layer.sublayers?.first?.addSublayer(self.layer)
}
}
I'm flutter and kotlin/android developer, so i don't know swift very well, can you create a project sample for me. Thank you!.
I'm not femilier with flutter either.
can you help me create a project sample with swift or object-C and i will use it to module in my project flutter
Sure, I will create a branch for you.
I am also a flutter developer and looking into having this working on Flutter with Swift configuration.
To give you some context @kuttz, here is how our appDelegate.swift looks:
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
it works fine, thank you very much
Thanks for your example project. but i want to have the following functionality, there are two buttons, clicking the first button will block screen recording, and clicking the second button will enable screen recording. Help me please!