1. When you create an object using new, alloc, or copy, the Count retain of the object reaches 1. You must delete this object release or autolease. In this way, it can be cleared only when its lifecycle ends.
2. When you use other methods to obtain
When you do not have a Mac or virtual machine, compile objective-C in windows.ProgramWhat about ??
Next, I will explain in detail how to compile objective-C language in windows.
1. Install the object-C CompilerThere are many objective-C
A framework is a software package that contains multiple classes.
Mac operations provide dozens of frameworks to help us quickly develop applications on MAC systems.Program.In these frameworks, there are some basic frameworks, including: string
Http://www.cocoachina.com/macdev/objc/2011/0124/2602.html
In the class implementation of objective-C, we often see the two keywords "self" and "super". Taking the previous OOP language experience as an example, C ++ assumes that self is equivalent
Using oC to call JS is simple. The system provides the stringbyevaluatingjavascriptfromstring method.
[Webview stringbyevaluatingjavascriptfromstring: @ "document. Location. href"]; [webview stringbyevaluatingjavascriptfromstring: @ "jsmethod ()
During iPhone development, you will often encounter multiple strings to be connected. The following is my summary:
Nsstring * Hello = @ "hello ,";
Nsstring * World = @ "world! ";
Nsstring * helloworld;
Connect the hello and world strings.
The following are the notes for learning objective-C 2.0. The original book I purchased is the original English version. Due to my limited level of English, there may be omissions in understanding.
Original book purchase address: Amazon
5. Memory
Memory management basics
When you write an application for Mac OSX, you can choose to allow garbage collection. This means that you do not have to consider memory management if it is not particularly complex. However, you will not always work in an
Log records
In objective-C, it is very easy to output log information to the console. In fact, the nslog () function is similar to the printf () function in C language.% @A symbol represents an object.
Nslog (@ "the current date and time is: % @",
In addition to category, objective-C has an associative extension mechanism.
Category is common and serves to extend some new methods to existing classes.
So associative is something that category cannot do, and attributes can be extended.
Official
1. nsarray is a static array. The content and length of the created array cannot be modified.
Instance:
// Use arraywithobjects to initialize an unchangeable array object. // Separate initialized values with commas (,) and end with nil. Nsarray6 *
1. Category (categories are also called categories. Add methods for classes without source code (System Classes and others' classes)
1) Role
Extends others' classes and can be used as an alternative to subclasses.
Put the code of the same class
Use objective-C to parse HTML or XML. The system uses either libxml or nsxmlparser. However, both of these methods require writing a lot of code to process captured content, which is not intuitive.
There is a better class library, hpple, which is
Reprinted please indicate the source: blog.csdn.net/zhangxingpingAttribute Declaration
The attribute Declaration uses the keyword @ property. The attribute declaration can be any part of the method declaration block in the @ interface class. @
Objective-C Language Features
1. Objective-C is based on the C language. It is a design language that adds extensions to the C language to create and operate objects.
2. Objective-C is a superset of ANSI-C that can be mixed with C and C ++ code.
3.
1. Simple replication can only implement shallow copy: assign values to the pointer, so that the two pointers point to the same memory space, and the operation is not safe.
2. The foundation class complies with the and protocols to implement the
Document directory
Nsarray
Variable Array
Enumeration
Quick Enumeration
Nsdictionary
Cocoa provides many collection classes for use. The following describes how to use the objects.
Nsarray
Nsarray is a cocoa class used to store an ordered
Several data types in objective-C are not the same as those in C. It is hereby recorded.
-ID is a pointer type that can point to any type of object.
-Bool is the same as char, but it is used as a Boolean value.
Yes indicates 1
No indicates
# Import int main (INT argc, char * argv []) {@ autoreleasepool {nslog (@ "Hello world! ");} Return 0;} the class and method in C ++ have determined the objective -- V Class-> message during the compilation period. If no exception is thrown, for
I recently started to learn about iPhone development. Turing's basic objective-C tutorial is a good Getting Started Guide Book. Some minor problems are found during the learning process. Although it is not critical, it is helpful for developers
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