I have studied objective-C over the past few days and briefly talked about my understanding and views on its memory management mechanism. If you have any ideas or different opinions, I can share them with you, first, objective-C uses the reference
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
Objective-C underlying data structure
Objective-C underlying data structure
Class Data StructureClass (pointer)
Typedef struct objc_class * class;/* this is the data structure generated by the compiler for each class. This structure defines a class.
// Implement carparts
// Implement carparts # import @ interface tire: nsobject @ end @ implementation tire-(nsstring *) Description {return (@ "I Am a tire. I last a while. ");} @ end @ Interface Engine: nsobject @ end @ implementation
I have had the basics of related programming languages. I believe that I understand the concepts of classes and objects in C ++/Java. I will not repeat it too much here.
For the definition and method usage of classes in OC, OC defines a set of its
The attribute mechanism in objective-C 2.0 provides us with a convenient way to obtain and set instance variables. It can also be said that the attribute provides us with a default configurator and accesser implementation. Before learning the
Some methods of string usage:
1. Create a dictionary nsstring variable string, and nsmutablestring immutable string. They are both objective objects.
Char * STR is an array of letters.
2. String formatting: stringwithformat, which is used to
Personally, I prefer to convert the delegate mode into the proxy mode. In other words, the first contact with the proxy mode is in Java, so it is essential to implement the modern rational mode and interface in Java. At that time, when I learned
1. nsdictionary and nsmutabledictionary
Nsdictionary dictionarywithobjectsandkeys :~, Nil
Create a dictionary using a key-Value Pair and end with the NIL flag
Nsdictionary initwithobjectsandkeys:
Use Key-value pairs to initialize the dictionary,
? ? The notification is a simple analogy. the boss of the company sent a notification to the following employees, saying that the company will go public tomorrow and all departments should make preparations. After the notification is sent, each
The structures that are frequently used in objective-C include nsange, nspoint, nssize (cgsize), and nsrect.
1 nsange
The prototype of nsange is
typedef struct _NSRange { NSUInteger location; NSUInteger length; } NSRange;
Nsmakerange
Enum and typedef, two examples are shown in the two sections respectively, as shown below:Enum direction {north, south, east, west };
Typedef Enum {north, south, east, west} direction;
I can't help wondering what are the differences between the
1. What is a protocol?
2. Description and use of protocols and categories
1. What is a protocol?
In objective-C, multi-inheritance is not supported, that is, a class cannot have multiple parent classes, but OC provides similar implementation
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.