IOS development requires a Mac, Xcode, and the iOS SDK. Because apple devices has its closed environment, so the iOS application development should be done on Mac equipment (black apple should, of course, also can, but you need to spend a lot of energy to basis for environment), Xcode is an integrated development environment, including the editor, convenient debugging, simulator and so on a series of development and deployment of tools, IOS SDK is necessary for application development. Different SDKS correspond to different iOS versions or devices. Usually, we need to download multiple iOS SDKS to ensure that the programs we develop can run normally on different versions of iOS.

 

Create a new project

 

Xcode provides a variety of engineering templates, Including master-detail Application, OpenGL Game, Page-based Application, Single View Application, Tabbed Application, Utility Application, Empty Application, etc. Select “File->New->Project” to bring up the following dialog box. Let’s choose an Empty Application to learn about the structure of an iOS Application.

 

Click Next and proceed to the Next screen. Enter the product name, class prefix, and company id.

 

 

Click Next and you will be prompted to select the folder to store the project. After selecting the folder, the following interface will pop up. This interface is the working interface of Xcode. Xcode, as an IDE development environment, gives us everything we need for iOS application development. Compilers, debugging tools, emulators, editors, version control, and more. As with all IDE tools, you should take the time to learn about your tools, either through help or through other means. The use of Xcode is not covered in this article.

 

 

Because our project is created from a template, the basic APP environment is already set up. Even though we haven’t entered any code yet, our blank program is ready to run. To run the App, choose to use the iOS Simulator. Emulators can provide emulation of different types of hardware, iPad, iPhone, and so on. You can Run your program by clicking the Run icon on the left side of the toolbar, or from the menu Product->Run, or by using the Command+R shortcut.

 

An overview of the code

 

An Application created using Empty Application will create some source code files by default to build the foundation for the App to run. Most of the work is done in the UIApplicationMain function, which is called automatically from the main.m file. The UIApplicationMain function creates an application object to create the base environment in which the App runs, including an infinite loop to respond to events in the application.

 

 

Let’s look at the Main contents of the main.m file. UIApplication uses the @AutoReleasepool declaration to support App memory management. Automatic Reference Counting (ARC) to track the usage of objects.

 

 

The UIApplicationMain call creates two important objects for your App. 1. An instance of UIApplication class, also called Application Object; A WSQAppDelegate instance, also called app Delegate. The App Delegate creates a blank window to display the app’s contents, and this is where we define the app. The WSQAppDelegate interface is defined in wsQAppdelegate.h, and the implementation is defined in wsQAppdelegate.m.

 

When the application starts, the Application Object calls a method defined in the App Delegate to perform a specific task. In the app delegate interface file, there’s only one UIWindow property defined.

 

 

Wsqappdelegate. m defines several functions that respond to system behavior, including application startup, activation, background, and so on. We can also add our own processing logic to these methods.

 

 

Create a Storyboard

 

Storyboards are visual representations of the App’s user interface, realistic screen content, and various transitions. Select File->New->File(or use the Command -n shortcut), select next, select iPhone in Device Family, and then proceed to select the location to save the File. After the Storyboard file is created, specify the Main Interface as the Storyboard to be created in the project properties. The Storayboard is just an empty container, and when you execute the program, you don’t get any interface, and then you need to add scene Scence to the Storyboard.

 

 

Select Main.Storyboard, and Xcode opens the Interface Builder, showing a blank canvas. Then open up the Object Library, go to the View Controller, and drag it into the Storyboard. You can see that there is an arrow on the left of the View Controller, which indicates that the current Scene is the initialization interface of the App. At this time, we can run the program and see this blank interface in the simulator, which indicates that all our configuration is successful.

 

 

Then you can drag labels, Input, and other controls onto the View Controller to layout your application, adjust font size, color, and so on, and the initial App creation is complete.


 

 

References:

1. Start Developing iOS Apps Today