IPhone development tutorial

Source: Internet
Author: User

Nowadays, smartphones are becoming increasingly popular, especially Apple's iPhone and Google's Android systems. Here I will introduce you to the basics of iPhone development. To help beginners get started as soon as possible, I tryCodeThe method of adding.

Mac and iPhone are essential for iPhone development. Although some people can install mac on a PC and use "black apple", it is not orthodox after all, such problems often occur, such as wireless or sound card problems. Therefore, it is best to have Mac. For iPhone, although it can be viewed on a computer through a simulatorProgramBut some functions can only be run on a real machine, so the iPhone is also a required condition. I am using the MacBook Pro 990 and iPhone generation. Now we should use iPhone 3G or 3gs.

Well, the first lesson of any program development starts with the classic Hello world, and I cannot avoid it. This lesson will print the hello World string on the iPhone. The process is as follows:

1. Download the iPhone SDK at http://developer.apple.com/, as shown below:

 

2. The iPhone SDK contains the development tools provided by Apple: xcode, interface builder, and instrument. They are completely free of charge and can be downloaded after the account is successfully registered and activated, this SDK has a very large capacity of about GB, so it takes a long time to download it.

3. After the download is complete, you can install it. The installation process is very simple. Simply double-click the downloaded DMG file to install it. The installation process takes about 10 minutes.

4. Find xcode In the developer/application directory after installation. double-click the app to run it. This is the development tool provided by Apple for Mac and iPhone development. You may wish to put it on the dock.

5. Start xcode and create an iPhone OS project named helloworld. Select view-based application on the iPhone OS on the left and select View-based application on the right, as shown in, then click the choose button. xcode prompts you to enter the project name and enter helloworld directly:

 

6. In the new project, click build and run to compile and run the program. The program running result is shown in:

 

7. We can see that the program runs smoothly and the iPhone simulator is displayed. There is an empty interface in it. After all, we have nothing to write.

8. Now you are going to display the hello World string on the interface. You need to write some code. iPhone and Mac development mainly use objective-C language, which is a superset of C language, readers familiar with C ++ and Java should be able to get started quickly, but the syntax of objective-C is somewhat different. Just take some time to adapt.

9. Open helloworldviewcontroller. in the M file, write the following code in the viewdidload function (note: this function is commented out by default, and you need to cancel the annotation before writing the code). The complete function implementation is shown in:

 

10. Click build and run again to run the program. The result displayed by the simulator is shown in. The Hello World string is displayed successfully!

 

In this section, I did not introduce the details involved in iPhone development. I just introduced the iPhone development process through a simple example to help you get started as soon as possible and cultivate confidence, later we will go deep into the specific process of iPhone development. For the next lesson, see :-)

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/ricohzhanglong/archive/2010/03/18/5391112.aspx

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.