Thank you for your responses!
When a delegate object conforms to another object's delegate protocol is it safe to assume that the methods implemented from the protocol are called automatically called from within the system?
For example, I have a delegate class called myDelegate that conforms to the UITextViewDelegate protocol. I implement the method textViewDidChange from the UITextViewDelegate protocol. When the user enters text into the UITextView is it safe to assume that my textViewDidChange method will be called automatically from within myDelegate, i.e. message sent to myDelegate object? The book I am studying does not make the point clear and I am having a hard time wrapping my mind around the concept of methods being called for me. Setting up an action makes sense to me because I have connected an UI object with the method from within my controller. In this case I have not done anything so I am a bit confused here. Any help would be greatly appreciated.
Thank you!
Edit: I think I am beginning to understand the answer. It appears that every (or is it only some) object has a delegate property. You set that delegate property to point to the the delegate object. So it appears that the system understands or is looking for certain events. When that event occurs it searches the delegate object for the associated method. If the method has been implemented by the delegate object the method will be called. If the method has not been implemented then nothing happens? I am still asking here because I am not sure if this is an accurate description of the process or not. Any and all help is greatly appreciated.
When a delegate object conforms to another object's delegate protocol is it safe to assume that the methods implemented from the protocol are called automatically called from within the system?
For example, I have a delegate class called myDelegate that conforms to the UITextViewDelegate protocol. I implement the method textViewDidChange from the UITextViewDelegate protocol. When the user enters text into the UITextView is it safe to assume that my textViewDidChange method will be called automatically from within myDelegate, i.e. message sent to myDelegate object? The book I am studying does not make the point clear and I am having a hard time wrapping my mind around the concept of methods being called for me. Setting up an action makes sense to me because I have connected an UI object with the method from within my controller. In this case I have not done anything so I am a bit confused here. Any help would be greatly appreciated.
Thank you!
Edit: I think I am beginning to understand the answer. It appears that every (or is it only some) object has a delegate property. You set that delegate property to point to the the delegate object. So it appears that the system understands or is looking for certain events. When that event occurs it searches the delegate object for the associated method. If the method has been implemented by the delegate object the method will be called. If the method has not been implemented then nothing happens? I am still asking here because I am not sure if this is an accurate description of the process or not. Any and all help is greatly appreciated.