gpt4 book ai didi

ios - 检查自定义键盘中 documentContextBeforeInput 中的字符

转载 作者:行者123 更新时间:2023-11-28 12:29:20 28 4
gpt4 key购买 nike

      ///Here is my Function  for Button press  


@IBAction func keyPressed(_ button: UIButton) {
var buttonTap = button.titleLabel!.text

///Here i call a variable for Get before input in textDocumentProxy

var jukto = textDocumentProxy.documentContextBeforeInput


/// Now i want check if Three digits of documentContextBeforeInput is "ABC" Than it should change to "DE"

if jukto == "ABC" {

buttonTap = "DE"

}

(textDocumentProxy as UIKeyInput).insertText("\(buttonTap!)")


}

///注意:我的 documentContext 中会有很多字符,但我想检查“ABC”这 3 位数字是否在一起,而不是它会改变。

最佳答案

  @IBAction func keyPressed(_ button: UIButton) {
var buttonTap = button.titleLabel!.text

///Here i call a variable for Get before input in textDocumentProxy

var jukto = textDocumentProxy.documentContextBeforeInput


/// Now i want check if Three digits of documentContextBeforeInputis "ABC" Than it should change to "DE"


if jukto.range(of:"ABC") != nil{
buttonTap = "DE"
}

(textDocumentProxy as UIKeyInput).insertText("\(buttonTap!)")


}

关于ios - 检查自定义键盘中 documentContextBeforeInput 中的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42527119/

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