Default Dynamic Behavior:The object is dynamically typed.The memory is allocated only at run time.A message is dynamically bound, and an object can only execute the message it understands as a "method call".
Although dynamic execution
Use@ Synchronized () indicates a synchronous method.
The method for implementing synchronization is different from other language types by using a mutex lock. The locked object determines the size of the lock range. For example, the locked instance
# Import Int Main ( Int Argc, Char * Argv []) { If (Argc = 1 ) {Nslog ( @" You need to provide a file name " ); Return 1 ;} File * File = fopen (argv [ 1 ], " R " ); Char Words [ 100 ]; While (Fgets (words, 100 , File) {words
1 category
Classification provides a way to extend the class definition. Classification can access the instance variables of the original class. Pay attention to the following points when using classification:
1.1 you cannot add any variables of
After that, the hacker became familiar with the platform class library ghost and studied the frequently-used event processing metrics controls. Then he could develop the app.
1. # Import# Import # Import "successfully created successfully named"In
Nil can only be applied in the ID type, that is, the pointer to the object in Java and C ++. Null is used as a non-object pointer.
See the following example:
-(Void)Observevalueforkeypath Nsstring *)Keypath ofobject ID)Object
1. the header file is still. h2. cpp is changed to. M.3. # import replaces # include, # import is guaranteed to be referenced only once, which is equivalent to # ifndef # define # endif mode in. h.4. Use @ interface... @ End to declare the class and
Since xcode 4.2, objective-C supports arc, which is a great boon for the majority of ipone developers. You don't have to face the ugly scenes like full screen [OBJ release] and [pool drain ].CodeMore importantly, you don't have to worry about the
Share the code for implementing the singleton mode in objective-C.
It seems that the design pattern is rarely mentioned in MAC development... At least we haven't seen any design patterns implemented with objective-c...
Code
Code
Disclaimer (read only !) : The original translations of all tutorials provided by this blog are from the Internet and are only for learning and communication purposes. Do not conduct commercial communications. At the same time, do not remove this
I want to call C ++'sCodeHere, I will summarize my methods,The Hello class is only an encapsulation of Calling C ++ for objective-C..
However, I feel that this is too inconvenient. If there are a lot of C ++ code, it will be very difficult to do
In object-C, selector has two meanings: In the source file, it points to a method call, and after compilation it points to an unque indentifier.
The type of the compiled selector is Sel, And the selector of the same name is the same.
Using
Syntax used for quick enumeration:For (type newvariable in expression) {statements}OrType existingitem;For (existingitem in expression) {statements}
Objects cannot be changed during enumeration.
Use the following three classes for quick
In the previous chapter, we talked about the extension of class methods. The reference is to add another instance variable (usually a static variable) to the existing class ), this function is only available after IOS and OS X v10.6.
The reason
Class Definition:
Although the compiler is not mandatory, the type of interface declaration and implementationCodeIt is best to put them in two different files for developers who use these classes to view them easily.
The implemented file
The content of this series corresponds to the content described in the official objective-C language, which is divided into the following parts:
Object, type, message
Define a class
Allocate and initialize memory for objects
Nonatomic: Non-atomic access, no lock when assigning values to attributes, multi-thread concurrent access will improve performance. If this attribute is not added, both access methods are atomic transaction access by default.(Atomic is a thread
Copyright Notice
This article is copyrighted by Vince Yuan (vince. yuan # gmail.com. Welcome to non-profit reprint, reprint must contain the original link http://vinceyuan.cnblogs.com, and must contain the complete content of this copyright
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.