gpt4 book ai didi

xcode - 如何知道何时将文本粘贴到 UITextView 中

转载 作者:行者123 更新时间:2023-12-03 14:27:21 27 4
gpt4 key购买 nike

将文本块粘贴到 UITextView 时会触发什么事件?粘贴文本时,我需要修改我的 textView 的框架。

谢谢阅读。

最佳答案

你的 UITextView 会调用它的 UITextViewDelegate 方法

 - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text

如果已设置代表。当在键盘上输入字符时,以及将文本粘贴到 TextView 中时,都会调用此方法。粘贴的文本是replacementText 参数。

http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextViewDelegate_Protocol/Reference/UITextViewDelegate.html#//apple_ref/occ/intf/UITextViewDelegate

关于xcode - 如何知道何时将文本粘贴到 UITextView 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12454857/

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