Objective-c is the best Class C, object-oriented programming language I have used. Objective-c is perfectly compatible with standard C, and on top of this is the Smalltalk element that interprets the fundamental concept of object-oriented, making it
Objective-c method in the backMethod calls in the Objective-cOC similar to c+, can not avoid the internal various means of communication, function calls, variable transmission, etc., can not avoid a variety of back-off and so on.One, class direct
In previous projects, our programming was written directly in a main.m file. The main () function of the class, @interface and @implementation parts are crammed into a file. This structure is also available for small programs and simple applications.
In the previous blog post, we had a simple "car model" to explain the composite relationship . In today's blog post, we'll go on to the last example, explaining the use of the access (accessor) method . The so-called access method is the method used
Xcode provides the function of converting a source file into an assembly file, The Assembly Code is as follows: # Assembly output for assemble. C # generated at 2:29:34 pm on Monday, May 25, 2014 # using debug configuration, x86_64
Introduction:
In the previous article, we talked about KVC. In this article, we learned KVO. The full name is: key value observing. the literal translation is: key value-based observer.
So what is its use? KVO is mainly used for view interaction.
Point Syntax:
The essence of point syntax is method call.When the dot syntax is used, the compiler automatically expands to the corresponding method person * P = [person new];
P. Age = 10; // The Compiler automatically converts this line of code
Category in objective-C)
1. Category concept: dynamically add new behaviors (methods) for existing classes)
2. How to Create a category
(1) Use xcode to generate a category
(2) You can manually generate a category and generate two @ interfaces
Objective-C adds the object-oriented Feature Based on the C language through a new set of syntax. The OC syntax frequently uses braces ([]) and does not limit writing very long method names, which often makes many people think the language is
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,
@ Indicates the "objective-c" flag, proving that you are using the objective-C Language
Objective-C language keyword, @ property and @ synthesize pair.
Function:Let the compiler automatically write a method declaration with the same name as the
The code block is essentially similar to other variables. The difference is that the data stored in the code block is a function body. Using a code block, you can pass in the number of arguments and get the return value just like calling other
Objective-C has a lot of dynamic features. Basically, it is also often mentioned and used with dynamic types (dynamic typing) and dynamic binding (dynamic binding) and dynamic loading (dynamic loading ).
These dynamic features are commonly used in
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
Do not repost the labor results of developers
Access member variables
From the perspective of object-oriented encapsulation, if you want to access member variables in the member class through methods, the member variables must have a scope
Nsnumber of objective-C Foundation, nsvalue, nsdate
1. Use nsnumber as follows:
In objective-C, there is an int data type, so why should we use the numeric object nsnumber. This is because many classes (such as nsarray) require the use of objects,
// First program example#import int main (int argc, const char * argv[]) { @autoreleasepool { NSLog (@"Programming is fun!"); } return 0; }
Before explaining this program, we need to describe the steps for compiling and running.
Although iOS 5/Mac OS X 10.7 starts to import arc, xcode4.2 can be used. ARC is an automatic reference counting function that provides automatic memory management for objective-C Programs during compilation. Arc allows you to focus on the code,
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