IOS7 Experience (1)--First application HelloWorld

Source: Internet
Author: User
Tags uikit

IOS7 Beta has been released and can't wait to download iOS 7 and Xcode 5 and try it out. Let's start with a simple Hello world and see what's changed.

1. Start XCODE5-DP;

2. Select File-New Project... from the menu to pop up the following window:

Notice that there is one more SpriteKit Game template, regardless of it, or select the familiar single View application, and then click the Next button;

3. Enter:HelloWorldin the Product Name input Box in the following dialog box, as shown in:

Note : Compared to the Xcode 4.6 version, the new project option does not have the use storyboards (using the storyboard), usesAutomatic Reference Counting (using automatic reference counting) and the include unit Tests (contains units test) three options.

4. Click the Next button to select the location of the Save project in the next dialog, and it is recommended to tick the Create git repository on My Mac option, although this article is not intended to involve git content. But using Code Manager development is a very good habit to ~_~. After selecting a location, click the Create button.

5. The next Xcode will automatically create and open the project for you, but the sight of the white is a piece of Ah, hehe. First look at the menu changes, see:

Review the 4.6 menu and see:

It is not difficult to find three more items, namely: Find(Find),debug (Debug),source control. Specific details friends can explore their own, this article no longer repeat.

6. Click the arrow position in the Open Project and Targets list (opens the project and target lists) button;

7. Now the Xcode interface has a hint of familiar taste, ~_~, as shown in:

Callout 1: You can choose a developer account, if you have more than one developer account, choose one here;

Callout 2: Set the device orientation;

Callout 3: Whether the status bar is hidden when the application starts;

Note : Except that callout 1 is a new option, the other two items are already included in the Xcode4.6 version, and these options are often modified when you create a new iOS project.

8. Scroll down the Project Properties window to see the icon and Application image settings properties, as shown in:

Note:images.xcassets is a new feature of Xcode 5, and one of the main reasons for its introduction is to facilitate application support for both iOS 6 and iOS 7, which is not covered in this article, and interested friends can refer to Apple's official iOS 7 UI Transition Guide.

9. Click the Capabilities tab of the project properties, as shown in:

It includes switches for icloud, Game Center, Passbook, IAP, maps, and other features, along with simple hints for introducing these features ~_~

OK, about the Xcode 5 interface changes, first simple familiar with this, the following to complete a simple helloworld:]

9. Before starting, run a look at the effect as shown in:

Peace, all can not see, hehe.

10. Click Main.storyboard, add a text Field, a label and a button, adjust and set the control size, position, and default text as shown in:

11. Click the button in the middle right of the toolbar to open the Assistant editor and switch to the ViewController.h file as shown in:

12. Drag and drop the text field and the label's iboutlet into the header file, and drag the button's action to the head file with the control+, as follows:

[CPP]View PlainCopy < param name= "wmode" value= "Transparent" >
    1. #import <UIKit/UIKit.h>
    2. @interface Viewcontroller:uiviewcontroller
    3. @property (Weak, nonatomic) Iboutlet Uitextfield *hellotext;
    4. @property (Weak, nonatomic) Iboutlet UILabel *hellolabel;
    5. -(Ibaction) Clickhellobutton: (ID) sender;
    6. @end

13. Click the location of the callout 2, switch to the viewcontroller.m file, and replace the Clickhellobutton with the following code: Method:

[CPP]View PlainCopy
  1. -(Ibaction) Clickhellobutton: (ID) Sender {
  2. //empty whitespace characters
  3. NSString *str = [_hellotext.text stringbytrimmingcharactersinset:
  4. [Nscharacterset Whitespaceandnewlinecharacterset]];
  5. if (str.length > 0) {
  6. [_hellotext SETTEXT:STR];
  7. [_hellolabel settext:[nsstring stringwithformat:@"Hello%@!", str]];
  8. }
  9. }

14. Run the application as shown in:

Get it done!

Next announcement: Unit test of IOS7 first experience.

Copyright notice: This article by http://blog.csdn.net/liufan321 or HTTP://WWW.CNBLOGS.COM/LIUFAN9 original, welcome reprint share. Please respect the author Labor, reproduced when the statement and the author of the blog link, thank you!

IOS7 Experience (1)--First application HelloWorld

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.