Dark Horse programmer----SEL

Source: Internet
Author: User

SELof the 1.SEL typedefinition2. Method ofStorage location
    • The list of methods for each class is stored in the class object
    • Each method has an object of the corresponding sel type
    • The address of the method can be found based on a Sel object, and the method is called
of the 3.SEL objectCreate

Way One:

  

  method Two: convert a string into SEL type data

  

4. Use the SELCalling Methods
    • The invocation of the Invisible parameter method:
①: Wraps the method (test) into the SEL type data;

②: The corresponding method address is found according to the SEL data; ③: The corresponding method is called according to the method address;

After integration:

Equivalent to:[P test];

    • Invocation of methods of tangible parameters

Equivalent to:[P test3: @ "abc"];

5.SEL ofOther usesAndUse note
    • SEL type data cannot be printed directly, it needs to be nsstringfromselector (_cmd), converted to string type, printed.

    • Each method hides a sel-type data _cmd, and the _cmd here represents the current Method!

    • Attention point: dead Loop

    • Actually sending the message to the object is to send the SEL;

Dark Horse programmer----SEL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.