After a long time, I almost forgot about objective-C. there is no systematic learning and coding. I used to read books, but now I have no machine learning. I need to pick it up again...
Note: What I'm talking about is the difference between objective-C and Java. In the same place, I just want Java developers to quickly master and understand objective-C.
Objective-C is different from Java:
1. Pay attention to the memory
Because nsobject in the foundation of cocoa framework provides the javasmselector method, only two data parameters can be passed. To pass more parameters, one of the simplest methods is to use RuntimeIDObjc_msgsend (ID Self,SelOp,...) runtime
. H: Header file. The header file contains class, type, function, and constant declarations.. M:Source codeFile. This is a typical sourceCodeFile Extension, which can contain objective-C and C code.. Mm:Source code file. Source code files with such
During the development process, we will encounter a lot of string operations. It is a common data type, and the usage of it is summarized below:
// 1. Create a constant string.Nsstring * astring = @ "this is a string! ";
// 2. Create an empty
From: http://www.cocoachina.com/bbs/read.php? Tid-12760.html
I have written similarArticleIn this article, we hope to help the new brother. Pai_^
The objective-C memory management mechanism in the iPhone system is flexible, that is, it can
Objects and ClassesA class consists primarily of two things: variables that can store data and methodsThat can perform operations.
SubclassesClasses can also inherit functionality from an existing class
Instance and class variables
Changing
If you define a retain property in an objective-C class, only obj. the attribute takes effect only when accessed in the form of VaR, that is, the getter/setter method of the member variable is used. Otherwise, the attribute cannot take effect. For
Recently, I plan to develop some applications for the iPhone, iPod Touch, and iPad, so I need to start learning objective C (a language similar to C developed by Apple ). Due to Apple's self-Closed Industrial Chain Development Model (from chips,
Objective-C is obviously different from other object-oriented systems. It has its own distinctive characteristics. Next we will introduce its features from this method: compatibility, String, class, method, attribute, protocol, and classification.
1
IntroductionObjective-C language keyword, paired with @ synthesize.Function: Let the compiler automatically write a method declaration with the same name as the data member to save the declaration of the read/write method.For example:1. In the
The series from C ++ to objective-C is over. I would like to reiterate that this series is not a complete objective-C Teaching document, but it is convenient for developers who are familiar with C ++ or C ++ (for example, a large number of Java
1. @ public, @ protected, @ private
I personally think that there is no clear difference between @ public and @ protected. If the objects within their scope are not set to @ property, the object is equivalent to the protected object, only the
The interface is often used during iPhone development. Apple has designed a good management idea for it, that is, using the common MVC mode. In the iPhone, all graphical controls are inherited from uiview, that is, "V ". uiview and its Child classes
In objective-C language, there are two ways to pass the method: ① selector ② blocks. This article mainly describes selector. blocks will be summarized later.
Message Passing is the core mechanism of objective-C language. In objective-C, there is no
Document directory
Dynamic Method Analysis
@ Dynamic refers to the Code provided by developers: setter is required for read-only attributes, and setter and getter are required for read/write attributes.@ Synthesize indicates that, unless the
Document directory
Dynamic types (iskindofclass, ismemberofclass, ID) of objective-C syntax
Dynamic types (iskindofclass, ismemberofclass, ID) of objective-C syntax
The ability of an object to obtain its type at runtime is called introspection.
1. Dynamic Allocation
Dynamic Allocation is handled by two functions: malloc and free. Use a parameter to call malloc to request memory. This function specifies the number of bytes required. Malloc returns a pointer to the number of bytes in the
Address: http://www.mulle-kybernetik.com/weblog/2011/10/how_to_build_libobjc_for_ OS _x.html
Max OS X: 10.6.8
Version to be compiled and run: 437.3
I just tried it myself and can compile it.
In addition, the header file contains an absolute path. If
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.