Tools for iPhone OS Development
(iPhone OS的开发工具)
To develop applications for iPhone OS, you need a Mac OS X computerrunning the Xcode tools. Xcode is Apple's suite of development toolsthat provide support for project management, code editing, buildingexecutables, source-level debugging, source-code repository management,performance tuning, and much more. At the center of this suite is theXcode application itself, which provides the basic source-codedevelopment environment. Xcode is not the only tool you use though, andthe following sections provide an introduction to the applications youuse to create iPhone applications.
( 为了开发基于iPhone OS的应用程序,你需要一台Mac OS X操作系统的计算机,并且安装了Xcodetools开发工具。Xcode是Apple开发工具套件中的一个,他提供了项目管理,代码编辑,编译可执行文 件,源代码调试,源代码存储管理,性能查看等等工具。这个工具套件的中心是Xcode这个应用程序,他提供了基本的源代码开发环境,Xcode不是你唯一 的开发工具,下面介绍一些其他的应用程序用来开发iPhone应用程序。)
Xcode
The focus of your development experiences is the Xcode application.Xcode is an integrated development environment (IDE) that provides allof the tools you need to create and manage your iPhone projects andsource files, build your code into an executable, and run and debugyour code either in iPhone simulator or on a device.
( 首先要关注的是Xcode应用程序,Xcode是一个集成开发环境【IDE】他提供了你开发iPhone项目的所有源代码的创建和管理,编译你的代码为可执行文件,运行调试你的代码,还有在在iPhone虚拟机上运行或者是直接在设备上运行。)
To create a new iPhone application, you start by creating a newproject in Xcode. A project manages all of the information associatedwith your application, including the source files, build settings, andrules needed to put all of the pieces together. The heart of everyXcode project is the project window, shown in Figure 1.This windowprovides quick access to all of the key elements of your application.The Groups and Files list is where you manage the files in yourproject, including your source files and the build targets that arecreated from those source files. The toolbar provides access tocommonly used tools and commands while the details pane provides aconfigurable space for working on your project. Other aspects of theproject window provide you with contextual information about yourproject.
( 创建一个新的iPhone应用程序,你可以从Xcode的创建新项目开始。一个项目管理了应用程序所有的信息,包含源代码,创建设置,和所有需要导出的 规则。每一个Xcode项目的核心是项目窗口,在下面的图中展现了。这个窗口可以让你很快的在应用程序的关键元素中切换。Groups和Files列表是 用来管理你的项目文件,包括了你的源代码文件,还有更具源文件的导出文件。工具栏允许你使用常用的一些工具和命令,详细资料面板用来设置你的项目的工作区 域,其他的一些项目床用可以让你用来展示你项目的前后关系。)
Figure 1 An Xcode project window
(图1 一个Xcode项目窗口)
Xcode comes with an advanced text editor, which supports features suchas code completion, syntax coloring, code folding (to hide code blockstemporarily), and inline annotations for errors, warnings, and notes.The build system in Xcode provides both appropriate default settingsand the ability to configure the environment to your heart's content.And if you need documentation, the Research Assistant providescontext-sensitive documentation while the Xcode documentation windowlets you browse and search for information.
( Xcode有一个强大的代码编辑器,他提供了入代码检查,颜色高亮,代码折叠【零时的影隐藏代码】,还有错误,警告,提示的文字注释。在Xcode环境 中提供了一些默认的设置你可以根据你心中想要的环境进行设置。并且如果你需要文档的帮助,Xcode的搜索助手可以让你实时的在Xcode窗口中浏览你想 要搜寻的信息。)
When you build your application in Xcode, you have a choice of buildingit for iPhone simulator or for a device. The simulator provides a localenvironment for testing your applications to make sure they behaveessentially the way you want. After you are satisfied with yourapplication's basic behavior, you can tell Xcode to build it and run iton an iPhone or iPod touch connected to your computer. Running on adevice provides the ultimate test environment, and Xcode lets youattach the built-in debugger to the code running on the device.
( 当你在Xcode中创建你的应用程序的时候,你可以选择为iPhone虚拟机还是真实的设备。虚拟iPhone提供了一个本地的环境可以让你测试你的应 用程序,和一些基本的行为。然后你基本满意后可以告诉Xcode上传到与你计算机相链接的iPhone或者iPodtouch上。在真实机器上的测试提供 了你最全面的测试环境,Xcode让你可以在真实机器上测试时提供调试功能。)
Figure 2 Running a project from Xcode
(图2 在Xcode中运行项目)
For details on how to build and run your project on iPhone OS, see Development Environment in iPhone OS Programming Guide
( 有关如何在iPhone OS上运行和创建你的项目请看 Development Environment in iPhone OS Programming Guide)
Interface Builder
InterfaceBuilder is the tool you use to assemble your application's userinterface visually. Using Interface Builder, you assemble yourapplication's window by dragging and dropping preconfigured componentsonto it. The components include standard system controls such asswitches, text fields, and buttons, and also custom views to representthe views your application provides. After you've placed the componentson the window's surface, you can position them by dragging them around,configure their attributes using the inspector, and establish therelationships between those objects and your code. When your interfacelooks the way you want it, you save the contents to a nib file, whichis a custom resource file format.
( Interface Builder 是用来组织创建应用程序的可视部分的或者说着用户图形接口。使用InterfaceBuilder你可以拖放一些定义好的组建在你的应用程序窗口中。这些 组件包含了标准的系统控制比如开关,文本框,按钮和其他一些自定的视图,通过他们你可以用来展现你应用程序中的界面。然后你可以把他们放到window对 象这个平面中,你可以在窗口中拖放他们,通过inspector设置他们的属性,并且建立他们和你的应用程序对象的连接。当你完成了创建视图后你将会用 nib文件的形式保存起来。)
[size=+0] The nib files you create in Interface Builder contain all theinformation that the UI Kit needs to recreate the same objects in yourapplication at runtime. Loading a nib file creates runtime versions ofall the objects stored in the file, configuring them exactly as theywere in Interface Builder. It also uses the connection information youspecified to establish connections between the newly created objectsand any existing objects in your application. These connections provideyour code with pointers to the nib-file objects and also provide theinformation the objects themselves need to communicate user actions toyour code.
( 你在InterfaceBuilder中创建的所有nib文件为UIKit在运行时构建相同的对象提供了信息。在运行是加载nib文件创建他们的运行时 版本,设置他们的属性让他们看起来和你在InterfaceBuilder中一样。他同样使用连接点的方法在你的新建对象和你的应用程序中的其他任何对象 之间建立关系。这写连接的对象可以让你的代码和nib文件的对象链接起来,同时也提供了用户命令动作对象的连接。)
Overall, usingInterface Builder saves a tremendous amount of time when it comes tocreating your application's user interface. Interface Buildereliminates the custom code needed to create, configure, and positionthe objects that make up your interface. Because it is a visual editor,you get to see exactly what your interface will look like at runtime.
( 总 的来说,在你创建你的应用程序图形用户接口的时候使用Interface Builder节约了你大量的时间。InterfaceBuilder让你摆脱了自己编写代码去创建,设置,定位那些界面对象。因为他是一个可视的编辑 器,你可以在构建的时候就发现运行时候的效果了。)
Instruments
To ensure that you deliver the best user experience for your software,the Instruments environment lets you analyze the performance of youriPhone applications while running in the simulator or on a device.Instruments gathers data from your running application and presentsthat data in a graphical display called the timeline. You can gatherdata about your application's memory usage, disk activity, networkactivity, and graphics performance. The timeline view can display allof the different types of information side by side, letting youcorrelate the overall behavior. of your application, not just thebehavior. in one specific area. To get even more detailed information,you can also view the detailed samples that Instruments gathers.
( 为了确定你开发了最好的用户体验的软件,Instruments环境可以让你分析当你的iPhone应用程程序在虚拟环境或者真实设备上运行时候的表 现。Instruments将会用时间轴图表的形式表现你运行应用程序时的数据,开销。你可以看到你应用程序的内存消耗,磁盘活动,网络活动,和图形表 现。时间轴的视图可以一一的展现不同的类型的应用程序系统信息,可以让你方便的收集应用程序的全部行为,而不是在一个特定区域的行为。为了得到更详细的信 息,你同时可以查看Instruments详细例子。)
Figure 3 Using Instruments to tune your application
(图3 使用Instruments来调试你的应用程序)
In addition to providing the timeline view, Instruments provides toolsto help you analyze your application's behavior. over time. For example,the Instruments window lets you store data from multiple runs so thatyou can see whether your application's behavior. is actually improvingor whether it still needs work. You can save the data from these runsin an Instruments document and open them at any time.
( 除了时间轴视图外,Instruments同样提供了工具来帮助你在运行时候查看应用程序的行为。举个例子,Instruments窗口可以保存多个运 行时候的数据,让你看见你的应用程序的行为那些需要改进或者那些需要重新编写,你可以在任何时间打开你保存在Instruments文档中的数据。)
For details on how to use Instruments with iPhone applications, seeDevelopment Environment iPhone OS Programming Guide.For generalinformation on how to use Instruments, see Instruments User Guide.
( 查看详细的资料有关使用Instruments你可以查看Development Environment iPhone OSProgramming Guide。一些使用Instruments的普通的方法可以查看Instruments User Guide)
(iPhone OS的开发工具)
To develop applications for iPhone OS, you need a Mac OS X computerrunning the Xcode tools. Xcode is Apple's suite of development toolsthat provide support for project management, code editing, buildingexecutables, source-level debugging, source-code repository management,performance tuning, and much more. At the center of this suite is theXcode application itself, which provides the basic source-codedevelopment environment. Xcode is not the only tool you use though, andthe following sections provide an introduction to the applications youuse to create iPhone applications.
( 为了开发基于iPhone OS的应用程序,你需要一台Mac OS X操作系统的计算机,并且安装了Xcodetools开发工具。Xcode是Apple开发工具套件中的一个,他提供了项目管理,代码编辑,编译可执行文 件,源代码调试,源代码存储管理,性能查看等等工具。这个工具套件的中心是Xcode这个应用程序,他提供了基本的源代码开发环境,Xcode不是你唯一 的开发工具,下面介绍一些其他的应用程序用来开发iPhone应用程序。)
Xcode
The focus of your development experiences is the Xcode application.Xcode is an integrated development environment (IDE) that provides allof the tools you need to create and manage your iPhone projects andsource files, build your code into an executable, and run and debugyour code either in iPhone simulator or on a device.
( 首先要关注的是Xcode应用程序,Xcode是一个集成开发环境【IDE】他提供了你开发iPhone项目的所有源代码的创建和管理,编译你的代码为可执行文件,运行调试你的代码,还有在在iPhone虚拟机上运行或者是直接在设备上运行。)
To create a new iPhone application, you start by creating a newproject in Xcode. A project manages all of the information associatedwith your application, including the source files, build settings, andrules needed to put all of the pieces together. The heart of everyXcode project is the project window, shown in Figure 1.This windowprovides quick access to all of the key elements of your application.The Groups and Files list is where you manage the files in yourproject, including your source files and the build targets that arecreated from those source files. The toolbar provides access tocommonly used tools and commands while the details pane provides aconfigurable space for working on your project. Other aspects of theproject window provide you with contextual information about yourproject.
( 创建一个新的iPhone应用程序,你可以从Xcode的创建新项目开始。一个项目管理了应用程序所有的信息,包含源代码,创建设置,和所有需要导出的 规则。每一个Xcode项目的核心是项目窗口,在下面的图中展现了。这个窗口可以让你很快的在应用程序的关键元素中切换。Groups和Files列表是 用来管理你的项目文件,包括了你的源代码文件,还有更具源文件的导出文件。工具栏允许你使用常用的一些工具和命令,详细资料面板用来设置你的项目的工作区 域,其他的一些项目床用可以让你用来展示你项目的前后关系。)
Figure 1 An Xcode project window
(图1 一个Xcode项目窗口)
Xcode comes with an advanced text editor, which supports features suchas code completion, syntax coloring, code folding (to hide code blockstemporarily), and inline annotations for errors, warnings, and notes.The build system in Xcode provides both appropriate default settingsand the ability to configure the environment to your heart's content.And if you need documentation, the Research Assistant providescontext-sensitive documentation while the Xcode documentation windowlets you browse and search for information.
( Xcode有一个强大的代码编辑器,他提供了入代码检查,颜色高亮,代码折叠【零时的影隐藏代码】,还有错误,警告,提示的文字注释。在Xcode环境 中提供了一些默认的设置你可以根据你心中想要的环境进行设置。并且如果你需要文档的帮助,Xcode的搜索助手可以让你实时的在Xcode窗口中浏览你想 要搜寻的信息。)
When you build your application in Xcode, you have a choice of buildingit for iPhone simulator or for a device. The simulator provides a localenvironment for testing your applications to make sure they behaveessentially the way you want. After you are satisfied with yourapplication's basic behavior, you can tell Xcode to build it and run iton an iPhone or iPod touch connected to your computer. Running on adevice provides the ultimate test environment, and Xcode lets youattach the built-in debugger to the code running on the device.
( 当你在Xcode中创建你的应用程序的时候,你可以选择为iPhone虚拟机还是真实的设备。虚拟iPhone提供了一个本地的环境可以让你测试你的应 用程序,和一些基本的行为。然后你基本满意后可以告诉Xcode上传到与你计算机相链接的iPhone或者iPodtouch上。在真实机器上的测试提供 了你最全面的测试环境,Xcode让你可以在真实机器上测试时提供调试功能。)
Figure 2 Running a project from Xcode
(图2 在Xcode中运行项目)
For details on how to build and run your project on iPhone OS, see Development Environment in iPhone OS Programming Guide
( 有关如何在iPhone OS上运行和创建你的项目请看 Development Environment in iPhone OS Programming Guide)
Interface Builder
InterfaceBuilder is the tool you use to assemble your application's userinterface visually. Using Interface Builder, you assemble yourapplication's window by dragging and dropping preconfigured componentsonto it. The components include standard system controls such asswitches, text fields, and buttons, and also custom views to representthe views your application provides. After you've placed the componentson the window's surface, you can position them by dragging them around,configure their attributes using the inspector, and establish therelationships between those objects and your code. When your interfacelooks the way you want it, you save the contents to a nib file, whichis a custom resource file format.
( Interface Builder 是用来组织创建应用程序的可视部分的或者说着用户图形接口。使用InterfaceBuilder你可以拖放一些定义好的组建在你的应用程序窗口中。这些 组件包含了标准的系统控制比如开关,文本框,按钮和其他一些自定的视图,通过他们你可以用来展现你应用程序中的界面。然后你可以把他们放到window对 象这个平面中,你可以在窗口中拖放他们,通过inspector设置他们的属性,并且建立他们和你的应用程序对象的连接。当你完成了创建视图后你将会用 nib文件的形式保存起来。)
[size=+0] The nib files you create in Interface Builder contain all theinformation that the UI Kit needs to recreate the same objects in yourapplication at runtime. Loading a nib file creates runtime versions ofall the objects stored in the file, configuring them exactly as theywere in Interface Builder. It also uses the connection information youspecified to establish connections between the newly created objectsand any existing objects in your application. These connections provideyour code with pointers to the nib-file objects and also provide theinformation the objects themselves need to communicate user actions toyour code.
( 你在InterfaceBuilder中创建的所有nib文件为UIKit在运行时构建相同的对象提供了信息。在运行是加载nib文件创建他们的运行时 版本,设置他们的属性让他们看起来和你在InterfaceBuilder中一样。他同样使用连接点的方法在你的新建对象和你的应用程序中的其他任何对象 之间建立关系。这写连接的对象可以让你的代码和nib文件的对象链接起来,同时也提供了用户命令动作对象的连接。)
Overall, usingInterface Builder saves a tremendous amount of time when it comes tocreating your application's user interface. Interface Buildereliminates the custom code needed to create, configure, and positionthe objects that make up your interface. Because it is a visual editor,you get to see exactly what your interface will look like at runtime.
( 总 的来说,在你创建你的应用程序图形用户接口的时候使用Interface Builder节约了你大量的时间。InterfaceBuilder让你摆脱了自己编写代码去创建,设置,定位那些界面对象。因为他是一个可视的编辑 器,你可以在构建的时候就发现运行时候的效果了。)
Instruments
To ensure that you deliver the best user experience for your software,the Instruments environment lets you analyze the performance of youriPhone applications while running in the simulator or on a device.Instruments gathers data from your running application and presentsthat data in a graphical display called the timeline. You can gatherdata about your application's memory usage, disk activity, networkactivity, and graphics performance. The timeline view can display allof the different types of information side by side, letting youcorrelate the overall behavior. of your application, not just thebehavior. in one specific area. To get even more detailed information,you can also view the detailed samples that Instruments gathers.
( 为了确定你开发了最好的用户体验的软件,Instruments环境可以让你分析当你的iPhone应用程程序在虚拟环境或者真实设备上运行时候的表 现。Instruments将会用时间轴图表的形式表现你运行应用程序时的数据,开销。你可以看到你应用程序的内存消耗,磁盘活动,网络活动,和图形表 现。时间轴的视图可以一一的展现不同的类型的应用程序系统信息,可以让你方便的收集应用程序的全部行为,而不是在一个特定区域的行为。为了得到更详细的信 息,你同时可以查看Instruments详细例子。)
Figure 3 Using Instruments to tune your application
(图3 使用Instruments来调试你的应用程序)
In addition to providing the timeline view, Instruments provides toolsto help you analyze your application's behavior. over time. For example,the Instruments window lets you store data from multiple runs so thatyou can see whether your application's behavior. is actually improvingor whether it still needs work. You can save the data from these runsin an Instruments document and open them at any time.
( 除了时间轴视图外,Instruments同样提供了工具来帮助你在运行时候查看应用程序的行为。举个例子,Instruments窗口可以保存多个运 行时候的数据,让你看见你的应用程序的行为那些需要改进或者那些需要重新编写,你可以在任何时间打开你保存在Instruments文档中的数据。)
For details on how to use Instruments with iPhone applications, seeDevelopment Environment iPhone OS Programming Guide.For generalinformation on how to use Instruments, see Instruments User Guide.
( 查看详细的资料有关使用Instruments你可以查看Development Environment iPhone OSProgramming Guide。一些使用Instruments的普通的方法可以查看Instruments User Guide)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9059159/viewspace-591163/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9059159/viewspace-591163/