How to connect the output of a UITextView delegate to a class that implements the UITextViewDelegate protocol?

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

I can not find an example in the docs

It is strange that in the UITextView the "delegate" output has this drag and drop "n drop" interface, for example, you can connect it to another widget , but, of course, I do not want to connect it to the widget, I want to connect it to an existing class .

+7
iphone delegates uitextview
source share
3 answers

If you mean “how to create an object created using the delegate code for my text view”, just set the delegation property (this will be drag and drop for you in Interface Builder):

textView.delegate = yourDelegateObject; 
+3
source share

To connect a delegate in Interface Builder:

(1) Drag the appropriate controller into the main nibs window and set the controller class to your delegate class. For example, if you have a subclass of NSObject called "MyDelegateClass", drag the Object controller and set it to the "MyDelegateClass" class.

(2) In the connection inspector for UITextView, click on the delegate button and connect it to the controller created in step (1).

What is it.

+6
source share

This is a pretty old question, but I also had problems with this, and I decided to share a modern Xcode 5 solution with it.

You must remove the delegate in a yellow circle with a white square inside it, which is located on this black bar under the view controller on your storyboard. This is not entirely obvious, so I provided a screenshot

enter image description here

+6
source share

All Articles