gpt4 book ai didi

iOS 12 - oneTimeCode OTP 委托(delegate)

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:20:39 24 4
gpt4 key购买 nike

当用户点击 iOS 提供的 OTP 建议时,是否有任何 delegate 被解雇?

我知道我可以使用 UITextFieldDelegate 方法来检测 textfieldtext 属性的变化,但我知道用户按下了这个按钮会让事情变得容易得多......

最佳答案

根据 Apple 的文章:About the Password AutoFill Workflow

For iOS apps, the system always sends a textDidChangeNotification notification when a view has been modified. It also calls one of the delegate methods of the view—but the exact method depends on the view’s type:

UITextField: The system calls your UITextFieldDelegate object’s textField(_:shouldChangeCharactersIn:replacementString:) method.

UITextView: The system calls your UITextViewDelegate object’s textView(_:shouldChangeTextIn:replacementText:) method.

Custom View adopting the UITextInput protocol: The system calls the insertText(:) method or replace(:withText:) in the UIKeyInput protocol.

您可以创建 UITextFieldUITextView 的子类并覆盖 insertText(:) 方法和 replace(:withText:) 方法,它将在用户点击快捷栏时调用。

关于iOS 12 - oneTimeCode OTP 委托(delegate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53548933/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com