1. Dynamic type
The runtime only knows the type of the object, the dynamic type is very common in programming, the simple is that the ID type, such as the agent at the time of the custom, ID type. At the moment we sometimes set our own methods, unsure, what type of object is passed in, we also ID type, and then inside the method to determine the type
2. Dynamic binding
When an object is instantiated, the object type is determined, and the object's properties and response methods are also determined. This is dynamic binding. White that is, when the object is determined, the corresponding properties and methods are bound. Then we can also dynamically to the object to add and implement methods. Class_addmethod and Method_setimplementation methods
3. Dynamic loading
As needed to load the required resources, for example, the retina screen above the image load @2x, two ordinary screen loading is the original
Run-time features Objective-c soul
OC many will be converted to the corresponding runtime method after compiling
1. In peacetime quite to use relatively little, but some tricky problems, with this, will be easy to solve.
1. Give one or two examples!!! If we want to encapsulate a database through fmdbase, and want to pass in any type model, I can create the corresponding database table and add, delete and so on. At this time, we can use, this OC running characteristics, dynamically get the properties of the object. The table is then created by stitching the strings with attributes.
2. In an example, KVO's underlying implementation, there is a dynamic creation of a class that inherits the object being listened to, and then overrides the setter method, changing the ISA pointer to point to the effect of being reached and listening.
Dynamic type dynamic binding dynamic loading