The first article is really no one to read ... All right... Then take notes and do it ... The first writing is to generate a HelloWorld, may also be hit with others, so a little bored, even the name of the change it
Okay, start writing the second article.
Before doing the first application without explaining any code, just write it, and now we have to learn something about objective-c.
First we know that Objective-c is an object-oriented language, and C is a process-oriented language, why we use Objective-c to write iOS programs, why not C actually learned these days I feel objective-c==c+ The Objective class library, in fact, is a kind of new syntax like C, and then apply these encapsulated libraries to achieve the functions we need, we know that Apple is very good for their programmers, I have been learning the process of standing on the shoulders of giants to program, Now let's take a look at what we used in the process of using OBJECTIVE-C.
First of all, the class
Learning C # must know the class, the class in my opinion is a more important piece of object-oriented thinking, because he is the equivalent of our object-oriented object, and we found in the Objective-c all the objects (I have seen) are pointers, perhaps did not learn C will feel the pointer is very painful, I will say my blog content as far as possible according to C # syntax, since it is difficult to understand, then let us directly create a class. We can use a terminal to create a. m file
After creating the first. m file, we write this class here
OK, let's generate this class, and then let's explain why, in the picture to the right of the system comes with the terminal, similar to the window cmd actually I think maybe I am not familiar with this thing, many people should be still very clear, this style is similar to the UNIX system, The file needs to be generated by the code, specifically, I do not repeat this here.
We are going to talk about the class we generated, we generated a blog such a class, so in @[email protected] we defined a blog such a class, in objective-c I have not seen that class does not need to inherit the parent class, So his parent class type we first inherit NSObject, and this nsobject class comes from Apple's own provided foundation framework, which is what we need to write when we use the terminal to connect our. m Files-framework Foundation reason, because the framework to apply the system with the framework, rather than write their own, of course, this is our head to write #import <Foundation/Foudation.h>, and I found a trick, In fact, for the system he has a lot of framework, in the application of no framework when we found that the head we are writing this framework of the #import < name/name. h> What do you mean, we're looking at a few system frameworks
This even if the system framework is in the catalogue, we will find that all the frameworks are. End of the framework, and then we will find several important frameworks, such as cocoa.framework,quartz.framework, which are important frameworks, and if we want to load him just use his name plus his name. h That's the way it is, For example I want to call quartz.framework, I just write #import <Quartz/Quartz.h> can call him, and #import than # # has a merit, he will automatically help you see if there are repeated calls, We used to use # include to load the header file, we may call multiple times the same header file, and now #import to help us automatically solve the problem ... Does it feel like calling the header file becomes a lot more convenient ...
Then let's look at the class, what the class is, the class is a collection of objects, no more direct mapping
After reading the above figure is not think things are clear a lot ... That's the point, but no one's going to take notes anyway.