I have read Apple's official document, "Advanced Memory Management Programming," and have never understood why the accessor method cannot be used in the Init and Dealloc methods. His usual work in practice, seemingly did not find any problems. Until
Instance variable:In fact, the explicit point is Ivar + setter + getter (instance variable + access method), but in OC the attribute is more literal this series of special keywords makes OC properties somewhat different.Member properties We should
Application of runtime mechanism in OBJECTIVE-CFirst, the initial knowledge of the runtimeObjective-c is a dynamic language, the so-called dynamic language, is in the execution of the program dynamically determine the variable type, the
OC It provides a different way of--category, which can dynamically add new behaviors to existing classes (methods), which ensures the original design of smaller classes, and then gradually joins the extensions.You do not need to create a subclass
Single caseand other languages of the singleton production is not much, can be said to be the simplest of a design pattern. But there are a few points to note that a singleton is just one instance of a class.So we're going to try to stop this class
Benefits of Encapsulation:
Filter for unreasonable values
The assignment process inside the Shield
Let the outside world not pay attention to the internal details
Benefits of Inheritance:
Do not change the original
Broker modeThe mediator pattern is a good interpretation of the Dimitri rule, and if you need to correlate any two unrelated objects, you need to do so through a third class. Intermediaries are the encapsulation of a group of objects, shielding the
First, what is a null pointer and a wild pointer1. Null pointer1> A pointer that does not store any memory address is called a null pointer (null pointer)The 2> null pointer is a pointer that is assigned a value of 0, and its value is 0 before it is
Advantages:Defensive programming can detect errors early in development.Example code:The following is the implementation code for the associated access method.- (void) Settire: (Tire *) Tire Atindex: (int)Index{if(Index0||Index>3) {NSLog (@"Bad
Atomic: A primitive operation that guarantees the setter/getter of these two methods. If more than one thread calls the setter at the same time, one thread does not appear before the all-setter statement, and the other thread starts to perform the
Understanding Method Swizzling is a good opportunity to learn the runtime mechanism. Not much to do in this, only translated by Mattt Thompson published in Nshipster's method swizzling article.Method Swizzling is a technique that changes the actual
Nonatomic: Non-atomic access, non-synchronous, multi-threaded concurrent access improves performance. If this attribute is not added, the default is two access methods are atomic transaction access.(Atomic is a thread-protection technique used by
Today, I saw an article titled "objective-c" in the garden.
2.0 with cocoa Foundation --- 5, class type, selector and function pointer ", I have made a wonderful speech and can't help but put it
Code Add notes here for future viewing. My personal
In objective-C, the real implementation of message and method is bound in the execution phase, rather than the compilation phase. The compiler converts the message to the call of the objc_msgsend method.The objc_msgsend method contains two required
The last time I read this book, I hurried through it. Recently I was not very busy. I revisited it and wrote my notes ~..
If you are interested, you can buy one. I think this book is quite good.
Because most of them are written on mobile phones when
Preface
Currently, objective-C (OC) is the core language for iOS development. It also works with C and C ++ during the development process. OC is mainly responsible for UI interfaces, C language and C ++ can be used for graphic processing. Recently,
OC (objective-C for short)
Based on the C language, an object-oriented syntax with the smallest scope is added (the most essential part of object-oriented is retained, and the content of OC is not much java, java does not have much content than C ++,
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