Ios7 initial experience (1) -- the first application helloworld

Source: Internet
Author: User

IOS 7 Beta has been released. I can't wait to download iOS 7 and xcode 5 and try it out. Let's make a simple hello world to see what changes have taken place.
1. StartXcode5-DP;
2. select from the menuFile-New project..., The following window is displayed:

Note that an additionalSpritekit gameFor the moment, no matter it or select a familiar TemplateSingle View ApplicationAnd then click Next;
3. In the following dialog boxProduct NameIn the input box, enter:Helloworld, As shown in:

Remarks: ComparisonXcode 4.6Version. The new project option is missing.Use storyboards (use storyboards),Use automatic reference counting)AndInclude unit tests (including unit test)Three options.
4. ClickNextClick to save the project in the following dialog box. We recommend that you selectCreate git repository on my MacOption, although this article does not involve git contentCodeManager development is a good habit ~ _~. After selecting the location, clickCreateButton.
5. xcode will automatically create and open the project for you. However, it is very white. First, let's take a look at the menu changes. See:


To review the 4.6 menu, see:

It is not difficult to find three more items:Find),Debug),Source Control (Source codeControl). You can explore the details by yourself. I will not go into details here.
6. ClickOpen project and targets List (open the project and target list)Button;

7. Now the xcode interface is so familiar with it ,~ _~, As shown in:

Note 1: You can select a developer account. If you have multiple developer accounts, select one here;
NOTE 2: set the device direction;
NOTE 3: ApplicationProgramWhether to hide the status bar at startup;
Remarks: Note 1 is a new option, and the other two items are included in xcode4.6. These options are often modified when you create an iOS project.
8. Scroll down the Project Properties window and you can see the icon and application image settings properties, as shown in:

Note:Images. xcassetsIt is a new feature of xcode 5. One of the main reasons it introduces is to make it easier for applications to support both iOS 6 and iOS 7, if you are interested, refer to Apple's official iOS 7 UI transition guide.
9. ClickCapabilitiesTab, as shown in:


The switch includes functions such as iCloud, game center, passbook, IAP, and maps, along with simple tips for introducing these functions ~ _~
OK. for changes to the xcode 5 interface, first familiarize yourself with this. Here is a simple helloworld:]
9. Run the command to check the effect, as shown in:

You can't see it anymore.
10. Click main. storyboard to add a text field, a label, and a button, and adjust and set the size, position, and default text of each control, as shown in:

11. click the button on the right of the toolbar to open the assistant editor and switchViewcontroller. hFile, as shown in:

12. Use Control + drag to drag the iboutlet of text field and label to the header file, and drag the action of the button to the header file. The header file is as follows:

# Import<Uikit/uikit. h>@ InterfaceViewcontroller: uiviewcontroller @ property (weak, nonatomic) iboutlet uitextfield*Hellotext; @ property (weak, nonatomic) iboutlet uilabel*Hellolabel;-(Ibaction) clickhellobutton :(ID) Sender;@ End

13. Click the location marked with 2 to switchViewcontroller. mFile, use the following code to replace clickhellobutton: method:

-(Ibaction) clickhellobutton :(ID) Sender {//Clear white space charactersNsstring * STR =[_ Hellotext. Text stringbytrimmingcharactersinset: [nscharacterset whitespaceandnewlinecharacterset];If(Str. length>0) {[_ Hellotext settext: Str]; [_ hellolabel settext: [nsstring stringwithformat:@"Hello % @!", STR] ;}}

14. Run the application, as shown in:

Get it done, close the job!
Next release: unit test for the first iOS 7 experience.

Copyright Disclaimer: This article was created at http://www.cnblogs.com/liufan9. you are welcome to transfer the file and share the file. Please respect the work of the author. Keep this note and the author's blog link when reprinting. Thank you!

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.