Objective-c Grammar Summary

Source: Internet
Author: User

1. Add minus sign before method

There is no concept of public and private in objective-c, that is to say that all are public. A minus sign represents the beginning of a function, method, and message. The plus sign means that you don't need to create an instance of a class, and other classes can call functions directly in the class (or a plus sign represents a static member function)

2.objective-c language #import When a header file is introduced, what is the difference between. h and. M?

The. h file is a header file that contains declarations of classes, types, functions, and constants;

. m files are source code files;

. MM: Source code files. Source code files with this extension can contain C + + code in addition to the OBJECTIVE-C and C code. This extension is only used when you really need to use C + + classes or features in your objective-c code.

Importing it in the header file ensures that the same file will be included only once, without repeating the import of the same type of file, whereas in the. m file you will find that the associated file can be imported in the other header files as well.

You can use the standard # include compilation option when you need to include header files in your source code, but Objective-c provides a better approach. The #import选项和 # Include option is exactly the same, except that it ensures that the same file is included only once. Objective-c's examples and documentation tend to use #import.

What is 3.use core data for?

Core data persistence is an upgrade to SQLite, it's iOS integrated, and before we say core data, let's talk about several classes used in CoreData.

(1) Nsmanagedobjectmodel (Managed object model)

Equivalent to an entity, but it contains relationships between entities

(2) Nsmanagedobjectcontext (Managed Object context)

Manipulating the actual content

Role: Insert Data query Update delete

(3) Nspersistentstorecoordinator (persistent storage assistant)

A connector equivalent to a database

(4) Nsfetchrequest (Request to get data)

Equivalent to a query statement

(5) Nspredicate (equivalent to query criteria)

(6) Nsentitydescription (solid structure)

(7) A package with a suffix named. Xcdatamodel

The. xcdatamodel file inside, edited with the Data Model Editor

Compiled for. MOMD or. Mom files, which is why there is no such thing in the file, and our program uses this thing

4.ARC

ARC is a new feature of iOS 5, called arc (Automatic Reference counting). Simply put, it is the code that automatically joins the Retain/release, and the code that originally needed to manually add a reference count to handle memory management can be automatically completed by the compiler.

This function is started in IOS 5/mac OS X 10.7 and can be used with Xcode4.2. The simple understanding of arc is that by specifying the syntax, the compiler (LLVM 3.0) automatically generates the reference count of the instance when the code is compiled to manage part of the code. At one point, arc is not a GC, it is just a static analyzer tool of code.

5.MRC,KVC,KVO, multi-threading, UI, runtime

Objective-c Grammar Summary

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.