This article is intended for readers, and the main introduction is to use Xcode to create a "HelloWorld" project.
1. Open Xcode and click New Project
Select project Type
2. Fill in the project information
3. Introduction to the Code
////main.m//HelloWorld////Created by Dengwei on 16/2/4.//Copyright (c) 2016 Dengwei. All rights reserved.////objective-c using #import to import a header file, the difference from # include is that the same header file will not be imported repeatedly#import<Foundation/Foundation.h>intMainintargcConst Char*argv[]) { //Create an auto-free pool@autoreleasepool {//Insert code here ...//put "Hello world! "Strings are printed to the console and are automatically wrapped when printed. //The string in objective-c language is denoted by @ "". //The NS begins with Objective-c's naming habit, which is related to the next SETP company that Steve Jobs founded. //%@ Printing a String objectNSLog (@"Hello, world!."); //types commonly used in Objective-cNsinteger i =Ten; //Boolean typeBOOL Flaga = YES;//NOBOOL FLAGB = TRUE;//FALSE//objective-c string (not of base type, object type, pointer)NSString *str =@"Dengwei"; //structure that represents a range//The first parameter is the start position//The second parameter is the length of the rangeNsrange rang = {1,3}; Nsmakerange (1,3);//equivalent to the previous line of code } return 0;}
4. Effect Demo
iOS Learning HelloWorld Project