1. What are the sub-categories of calayer? Use?
2. What are the common Crash scenes?
3. How to use the @protocol and category @property
4. What is method swizzling?
5, how to make their own class with the copy modifier? How do I rewrite the setter with the Copy keyword?
6. What is the iOS signature mechanism about?
Answer:
1. What are the sub-categories of calayer? Use?
Cashaperlayer
Cagradientlayer: Color transitions
Caemitterylayer: Particle effects
Catransformlayer: Constructs a hierarchical 3D structure by adding depth of field to a layer.
Careplicatorlayer: Layer Copy
Cascrolllayer
Catiledlayer: Provides a way to save memory rendering overhead
Catextlayer:
Caeagllayer:
Avplayerlayer: Play Video
2. What are the common Crash scenes?
Array out of bounds
The Zombie object was accessed. Objects that have been released
Access the wild pointer. Exc_bad_access.
A method that does not exist is accessed. Unrecognized selector
Multithreading concurrent Operations
Release the timer before the timer next callback
3. How to use the @protocol and category @property
Objc_setassociatedobject/objc_setassociatedobject
4. What is method swizzling?
In short, it's a method exchange.
Calling a method in Objective-c is actually sending a message to an object, and the only way to find the message is by selector's name. By using the dynamic characteristics of objective-c, we can implement the corresponding method of the selector in the runtime, and achieve the purpose of linking to the method.
Each class has a list of methods, the name of the method and the method to implement the mapping relationship, the essence of selector is actually the method name, imp a bit like a function pointer, pointing to the specific method implementation, through selector can find the corresponding imp.
Selector--and corresponding IMP
Several ways to realize the Exchange method
Implementation of two methods using Method_exchangeimplementations Exchange
Implementation of using Class_replacemethod substitution method
Use Method_setimplementation to directly set up an imp for a method.
5, how to make their own class with the copy modifier? How do I rewrite the setter with the Copy keyword?
6. What is the iOS signature mechanism about?
5, how to make their own class with the copy modifier? How do I rewrite the setter with the Copy keyword?
The Nscopying protocol is required if you want the object you write to have a copy function. If a custom object is divided into a mutable version and an immutable version, then both the Nscopyiog and nsmutablecopying protocols are implemented.
6.
https://www.jianshu.com/p/ad29445eb91c
IOS Face Questions