iOS learning Note (ii) First app--hello world

Source: Internet
Author: User
Tags vars

Original address: http://blog.csdn.net/shangyuan21/article/details/18416537

In an article on Windows7, using VMware to build the iphone development environment describes how to install the Mac OS X operating system on Windows, this article describes the installation of Xcode and the development of the first application

1. Download and install Xcode

After installing the Mac operating system, open the inside browser can go directly to the Apple's official website, search in the website Xcode can go to Xcode's download interface

You will need to register an Apple ID during the download process, which is simply not covered in detail here. The following illustration is a list of the searches in my development environment for you to refer to

It is important to note that not all Xcode is available, and that Xcode and Mac OS X operating systems need to be matched to each other, depending on the situation below

Xcode each version and Mac OS x correspondence relationship

I download the Xcode4.5 here. After downloading, it is a. DMG type of file. The type of file for Mac OS X is equivalent to the EXE type of Windows relationship, as long as click on the DMG file to run the app

After the start of the interface such as

2. Create your first app Hello World

As with all development languages, the first app starts with Hello

After you start Xcode, click the Create a new Xcode project button, as

Enter the following interface

This interface is a template provided by Xcode for developers to choose from. For our first program, select the single View application template. Select the template and click the Next button to enter the edit interface of the project properties

For the above interface, Product name is the name of the project, Organization name is the organization name, and company identifier is the identifier for

Use the developer account to develop the application needs to be aware of the need to register with the developer account identifier used, the developer Account Development app and release and real-time debugging of the relevant content, we will be described in the following content,

This article does not consider, as long as you know what it is to do something.

Devices can choose whether the app is an iphone or an ipad app, and the default is that both are compatible. We're going to choose the default.

Finally, tick out the two check boxes for red in the chart and click Next to enter the project editing screen.

Click on the red file to see the right side of the interface below

Here is the final display on the iphone screen effect, by default, there is no control, the diagram of the logon button when I later added.

To do this, click the Round rect button in the lower-right navigation section as

Click ViewController.h in the project to enter the following code in front of @end

[OBJC]View Plaincopy
    1. -(ibaction) showmessage;

Then enter the following code in front of the VIEWCONTROLLER.M in @end

[OBJC]View Plaincopy
    1. -  (ibaction) showmessage  
    2. {  
    3. uialertview *helloworldalert = [[uialertview ALLOC]  
    4. initwithtitle:@ "my   first  app "  message:@" hello,   world! "    
    5. delegate:nil  cancelbuttontitle:@ "OK"   Otherbuttontitles:nil];  
    6. [ Helloworldalert SHOW];  
    7. }  

The first sentence Uialertview *helloworldallert is in defining a message box that can be similar to the MessageBox in C + +. The following content is in the

Initializes some basic properties, such as the title, cue content, the name of each button, and so on. It is important to note that all content is defined using the @ plus string. The last sentence of Helloworldalert show is to display this cue box. Be careful not to call the Show method using the dot number in a language such as C + + or java. After these edits, note the save. You can use the shortcut key win S (Mac inside is command S). Finally, we need to associate the buttons with the defined methods. Click iphone. xib file, go to editor interface. Click the Control key, then drag the mouse button to the file ' s owner interface, select the associated method such as. Select the ShowMessage method that appears, after saving the file, click the Run button in the upper left corner to run our compiled program on the virtual machine, or the shortcut key win R. Build is win B. After running, such as clicking the Logon button, you can see the effect of our well-defined ShowMessage method, pop up Hello World's prompt box. As shown in the results, the entire program has been developed as a reference article:1. http://hi.baidu.com/zyb_debug/item/7ebbb012a4073ba6feded5d6 2.IOS from beginner to proficient

iOS learning Note (ii) first application--hello world

Related Article

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.