如何连接“委托”一个UITextView的出口到一个实现UITextViewDelegate协议的类? [英] How do you connect the "delegate" outlet of a UITextView to a class that implements UITextViewDelegate protocol?

查看:140
本文介绍了如何连接“委托”一个UITextView的出口到一个实现UITextViewDelegate协议的类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将UITextView的代理插座连接到实现UITextViewDelegate协议的类?

How do you connect the "delegate" outlet of a UITextView to a class that implements UITextViewDelegate protocol?

我似乎找不到一个例子在文档

I can't seem to find an example in the docs

奇怪的是,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协议的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆