How do you connect the quot;delegatequot; outlet of a UITextView to a class that implements UITextViewDelegate protocol?(您如何连接“代表?UITextView 的出口到实现 UITextViewDelegate 协议的类?)
问题描述
如何将 UITextView 的委托"出口连接到实现 UITextViewDelegate 协议的类?
How do you connect the "delegate" outlet of a UITextView to a class that implements UITextViewDelegate protocol?
我似乎找不到示例 在文档中
奇怪的是 UITextView 的代表"插座有拖放界面的东西,就像你可以将它连接到 另一个小部件但当然,我不想连接它到一个小部件,我想把它连接到一个现有的类.
The weird thing is the UITextView's "delegate" outlet has that drag 'n drop interface thingy, like you can wire it up to another widget but of course, I don't want to wire it up to a widget, I want to wire it up to an existing class.
推荐答案
如果您的意思是我如何将使用代码创建的对象作为我的文本视图的委托",只需设置委托属性(这就是拖动在 Interface Builder 中将为您做):
If you mean "how do I make an object that is created with code the delegate for my text view", just set the delegate property (this is what dragging in Interface Builder will do for you):
textView.delegate = yourDelegateObject;
这篇关于您如何连接“代表"?UITextView 的出口到实现 UITextViewDelegate 协议的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:您如何连接“代表"?UITextView 的出口到实现 UITextViewDelegate 协议的类?
基础教程推荐
- Android Volley - 如何动画图像加载? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
