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:
#import <UIKit/UIKit.h> @interface viewcontroller:uiviewcontroller@property (weak, nonatomic) Iboutlet Uitextfield *hellotext; @property (weak, nonatomic) Iboutlet UILabel *hellolabel;-(ibaction) Clickhellobutton: (ID) Sender; @end
13. Click the location of the callout 2, switch to the viewcontroller.m file, and replace the Clickhellobutton with the following code: Method:
-(Ibaction) Clickhellobutton: (ID) Sender { //empty white space character nsstring *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:
First Application HelloWorld