What is Objective-C Delete?

Asked 2 years ago, Updated 2 years ago, 105 views

I have been using Objective-C's Delegate for some reason, but I would like to deepen my understanding. Right now, I have to delete it because I want to use UITableView.

  • Exact meaning of Delete
  • Design Positioning

What does look like?

ios objective-c delegate

2022-09-30 11:08

4 Answers

"Delegate" in Objective-C is a type of design pattern in application implementation, rather than a specific feature provided by the programming language Objective-C (unlike Objective-C, there is a language "delegate" in C#).

Because Objective-C delivery is just a pattern ( 上 design rule), certain rules are required for coding to have a common understanding among software designers.Below is an excerpt from Apple's official document Objective-C Programming Concept.(For ease of reading, we removed the non-essential parts.)

Page 22:

A delegate is an object that is processed on behalf of or in conjunction with an event in a program.
[...]
How Deligate Works
The design of a delegate is simple; the delegate class (deligate class) typically has an outlet or property named delegate.[...]

Page 24:

Deligate Message Format
There are rules for naming the delivery method.[...]

Page 28:

To implement a delegate in a custom class, follow these steps:
* Declare the delegate accessories method in the class header file. [...]
* Implement accessories methods.[...]
* Declare the protocol for the delegate. [...]


2022-09-30 11:08

As Mr. Kmugitani said, I think it would be good to read the official document first (there aren't many pages).
If you read it and understand it somehow, you will understand better if you create a class with Delete yourself.

It's quite broken, but Objective-C looks like this.
MyView.h

@protocolMyViewDelegate<NSObject>
// be executed upon completion of the process
-(void)processCompletion
@end

MyView.m

 - (void) completion
{
    // Take the Action You Need in MyView

    // call the delegate method
    _delegate processCompletion;
}

Also, I don't know if this will be helpful, but if you touch another language a little bit, you may notice it.
In my case, I found out a little when I touched the Android Event Listener.


2022-09-30 11:08


for object orientation and delete information in the following documentation "Re-introduction to JavaScript, the most powerful object-oriented language!"
http://www.slideshare.net/yuka2py/javascript-23768378
Personally, the slide below was the most helpful.
new
delegate


2022-09-30 11:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.