码迷,mamicode.com
首页 > 移动开发 > 详细

The beginning iOS8 Programming with Swift 中文翻译 - 8

时间:2015-12-11 20:45:11      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:

前段时间回趟老家(奶奶过世)所以,几天没更新...接下来继续.!

Familiarize Yourself with Xcode Workspace   使自己熟悉Xcode的工作空间

Before we move on to the coding part, let’s take a few minutes to have a quick look at the Xcode workspace environment. In the left pane is the project navigator. You can find all your project files in this area. The center part of the workspace is the editor area. You do all the editing stuff here (such as editing the project setting, source code file, user interface, etc) in this area. Depending on the type of file, Xcode shows you different interfaces in the editor area. For instance, if you select ViewController.swift in the project navigator, Xcode displays the source code in the center area (see figure 1-7). If you select the “Main.storyboard”, which is the file for storing user interface, Xcode shows you the visual editor for storyboard (see figure 1-8). 

在我们关注编码部分之前.让我们花费几分钟来对Xcode工作环境进行一个快速浏览.在项目导航栏的左边区域,你可以找到所有的项目文件.工作空间的中间部分是编码区域.你可以在这个区域做所有的编辑相关事情(比如编辑项目设置,资源文件,界面搭建等等), 得益于文件的不同类型,Xcode在编辑区域会向你展示不同的界面.比如,如果你在项目导航栏选择了ViewController.swift,Xcode在中间区域显示的是下图1  如果你选择的是Main.stroyboard,对,就是那个用户交互界面的存储文件,Xcode会向你展示如图2的叫做stroyboard的界面编辑工具.技术分享

技术分享

 

The rightmost pane is the utility area. This area displays the properties of the file and allows you to access Quick Help. If Xcode doesn’t show this area, you can select the rightmost button in the toolbar to enable it. 

最右面的窗格是工具区,这个区域展示的是文件的内容并且允许你使用快速帮助.如果Xcode没有现实这个区域,你可以选择工具栏的最右侧按钮去使他可用.

The middle view button of the view selector is deselected by default. If you click on it, Xcode displays the debug area right below the editor area. The debug area, as its name suggests, is used for showing debug messages. We’ll talk about that in a later chapter. So don’t worry if you do not understand what each area is for. 

在中间的界面上,界面方法默认是关闭的.如果你点击了他,Xcode将在右下角的区域现实调试区域.就像名字那样,调试区域就是被用作显示调试信息的.我们将在后面章节讲解,所以,如果你不太明白每个区域做什么的,也不用太过担心.

 

技术分享

Run Your App for the First Time  第一次运行你的APP

Until now, we have written zero lines  of code. Even so, you can run your app using the built-in Simulator. This will give you an idea how to build and test your app in Xcode. In the toolbar, you should see the Run button. If you hit the Run button, Xcode automatically builds the app and runs it in the selected Simulator. By default, the Simulator is set to iPhone 6. You can click the iPhone 6 button and you’ll see a list of available Simulators. As we’re going to build an iPhone app, you can use iPhone 6 (or other iPhone models) as the Simulator. For this demo, I choose iPhone 5s. Once selected, you can click the Run button to load your app in the Simulator. Figure 1-11 shows the simulator for an iPhone 5s. 

直到现在,我们还没有写一行代码.即便如此,你也可以使用内置的模拟器运行你的APP,关于如何在xcode里运行及测试你的app,这将给你一个想法.在工具栏中,你可以看到运行按钮,如果你点击了这个按钮,Xcode将自动编译你的app并且运行在选择的模拟器上.默认情况下,模拟器会被设置为iPhone6,你可以点击iPhone6按钮,并且你可以看到一个可用模拟器的列表.当我们正在创建一个iPhone的app的时候,你可以使用iPhone6(或者其他的模拟器)作为模拟器,这个demo中,我选择iPhone5S,一旦选择,你可以点击运行按钮,使你的app在模拟器中加载,下图将展示iPhone5S模拟器.

技术分享

A white screen with nothing inside?! That’s normal. As we haven’t implemented the user interface or written any lines of code, the Simulator shows a blank screen. To terminate the app, simply hit the “Stop” button in the toolbar.

Try to select another simulator and run the app. Just play around with it so you’ll get used to the Xcode development environment. 

一个空白的没有任何信息存在的屏幕?这是正常的.当我们没有实现用户交互界面或没有写任何一行的代码,模拟器将现实一个空白的屏幕.如果想要结束app,则在工具栏简单的点击"stop"按钮.试着选择别的模拟器去运行app,玩一玩儿他吧,因为你必须熟悉一下Xcode开发环境.

Designing User Interface Using Storyboard   用stroyboard设置用户交互界面

Now that you have a basic idea of the Xcode development environment. Let’s move on and design the user interface of your first app. In the project navigator, select the “Main.storyboard” file. Xcode then brings up a visual editor for Storyboards known as Interface Builder. 

现在你对Xcode开发环境有了一个基础的认识.让我们开始为你的第一个app设置用户交互界面吧.在项目的导航栏中.选择"Main.stroyboard"文件,然后Xcode将展现一个Stroyboard用户界面编辑器.

技术分享

The beginning iOS8 Programming with Swift 中文翻译 - 8

标签:

原文地址:http://www.cnblogs.com/changjianioser/p/5039995.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!