30 days Learn objective-c--1 opening

Source: Internet
Author: User

Objective-c, usually writing OBJC and less used Objective C or OBJ-C, is an object-oriented programming language that expands C. It is mainly used in Mac OS X and GNUstep, which use the OpenStep standard system, and it is the basic language in NeXTSTEP and OpenStep. Objective-c can be written and compiled on GCC and clang operating systems because GCC and clang contain objective-c compilers. At the beginning of the 1980, Brad Cox invented objective-c at his company StepStone. He is very concerned about the real availability of software design and programming.

Objective-c as the same time in the same era as the language, Microsoft has chosen C + +, and Apple chose the obj-c, now Apple's strong, developer friendly, and the stability of the iOS system must have a certain relationship (little ya: You have a lot of nonsense, not to rush to the point. PS: This,,,,,,,,,,,,,)

Language seems to be around HelloWorld, after all, the landlord is also from this beginning, that according to the old ritual, we also start from HelloWorld. (Little ya: Tacky)

  

Then we come to Duan HelloWorld, understand OBJC (PS: In order to write objective-c convenient, use OBJC shorthand. Xiao ya: Really lazy)

Let's take a look at the details of this program, (PS: This tutorial requires a certain programming basis)

1. '//' denotes code comments, comments can also start with '/' and * Two characters, indicating the beginning of the comment, but must terminate the comment, to terminate the comment, you need to

Use * and '/' characters, and no spaces can be inserted in the middle

In 2.OBJC, case-sensitive, again, OBJC doesn't care where you enter code in the program line.

3. Header files

#include <Foundation/Foundation.h>

This is a system to ask the file, that is, this file is not created by you, #import表示讲改文件的信息导入到程序中.

The 4.main function doesn't explain much.

5.autoreleasepool explain in detail what's going on, the program statements between {} are executed in the context of the "auto-free Pool (Autoreleasepool)", and the mechanism for automatically releasing the pool is that it allows the application to create new objects, The system can efficiently manage the memory used by the application. Related things are explained in detail in memory management and automatic reference counting.

[Email protected] "programming is fun!", where the @ symbol precedes a pair of double-quoted strings, which is called a constant NSString object. PS: If you have learned C, don't be fooled by @, if there is no @ character in front of you, it means that you are writing a string of constant C type; With this symbol, you are writing a nssring string object.

7.NSLog is a function in the OBJC library that simply displays or records its parameters (or the list of parameters, which you'll see later). The use of NSLog is about the same as printf (Little ya: What the hell is this?) PS: Hey, it seems that learning this is a bit of programming basis to do it.

Oh, to this beginning seems to be over (little ya: This,,, content is very small AH: PS: Please look forward to the next article)

Little ya: Suspense shameful!

30 days Learn objective-c--1 opening

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.