Runtime run time

Source: Internet
Author: User

First, runtime is a set of low-level C language Library, compiler in compiling object-c code is, eventually converted to runtime C language code.

For example: [UIView alloc]; At compile time it will be converted to Objc_msgsend (UIView, @selector (alloc));

There is an Isa pointer within each object that points to the class in which the object resides (there is also an Isa pointer to its meta-class metaclass), and when the method is called, the compiler will look up through the ISA pointer one layer at a time until the root class (root metaclass) is found, if not found, will be an error. The function is called after the function pointer is found;

Second, by adding #import <objc/runtime.h>, we can invoke the method provided by runtime to implement the operation of class creation, method substitution, method implementation, etc.

Thirdly, some famous third-party libraries have used runtime:afnetworking, sdwebimage and so on, and KVO's bottom realization also used the runtime;

Runtime run time

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.