No matter which programmer, or what computer language to learn, the first program written is basically Hello world. Today we use OC to implement the first program: Hello World.
Select Create a new project in Xcode, select OS X in the dialog box, select Application below, select command line tool on the right, indicate that you are using shell, click Next, enter the project name in the next dialog, and select the development language. You can see that you can choose the Swift,oc,c++,c language here, and finally select the workspace directory and click Create to build the project.
After the project is created, open the main.m file and discover that the following code has been automatically generated:
#import <foundation/foundation.h>int Main (int argc, const char * argv[]) { @autoreleasepool { //insert Cod e here ... NSLog (@ "Hello, world!"); } return 0;}
Haha, it seems to print the hello,world! The code system has been written for us. Directly click the Run button in the upper left corner and discover that it has been output in the console: hello,world! :
。
OC's first program is finished, do not need us to write a line of code, haha.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Write the first program with Objective-c--hello,world!