About iOS App Programming
关于IOS App编程
This document is the starting point for creating iOS apps. It describes the fundamental architecture of iOS apps, including how the code you write fits together with the code provided by iOS. This document also offers practical guidance to help you make better choices during your design and planning phase and guides you to the other documents in the iOS developer library that contain more detailed information about how to address a specific task.
本文是创建一个IOS应用程序的起点。本文描述了IOS应用程序的基础架构,包括了你如何写与IOS提供的代码相结合的代码。本文也提供了实践指导来帮助你在设计和计划阶段更好的做决定,并且指导你去参考IOS开发库中其他的文档,那些文档里包含了关于解决一个问题的更详细的信息。
The contents of this document apply to all iOS apps running on all types of iOS devices, including iPad, iPhone, and iPod touch.
文本的内容适用于运行于所有IOS设备的所有程序,包括iPad,iPhone和iPod touch.
Note: Development of iOS apps requires an Intel-based Macintosh computer with the iOS SDK installed.
注意:IOS应用程序的开发需要一个装有Macintosh系统的计算机并且安装了IOS SDK。
At a Glance
概览
The starting point for any new app is identifying the design choices you need to make and understanding how those choices map to an appropriate implementation.
任何新app的起点是确定设计选择,你需要理解并且做这些选择如何映射到一个合适的实现方法上。
Translate Your Initial Idea into an Implementation Plan
把你最初的想法翻译成一个可实行的计划
Every great iOS app starts with a great idea, but translating that idea into actions requires some planning. Every iOS app relies heavily on design patterns, and those design patterns influence much of the code you need to write. So before you write any code, take the time to explore the possible techniques and technologies available for writing that code. Doing so can save you a lot of time and frustration.
每一个好的应用程序都有一个好的想法,但是把这些想法翻译成为具体的行为需要一些锻炼。每个应用程序严重的依赖于设计模式,这些设计模式影响到了你需要写多少代码。因此,在你写代码之前,花点时间来探索可能的技术和写这些代码有效的技术。这样做可以为你节省许多时间和少遇到很多挫折。
Relevant Chapter: “App Design Basics”
有关章节:App设计基础
UIKit Provides the Core of Your App
The core infrastructure of an iOS app is built from objects in the UIKit framework. The objects in this framework provide all of the support for handling events, displaying content on the screen, and interacting with the rest of the system. Understanding the role these objects play, and how you modify them to customize the default app behavior, is therefore very important for writing apps quickly and correctly.
UIKit为你的App提供了核心
一个iOS app的核心基础是内置UIKit框架中的对象。这个框架中的对象提供了对处理事件、显示屏幕内容和与系统交互都提供了支持。理解这些对象扮演的角色,并且理解你修改他们将如何影响到app的行为,因此对于更快更正确的写apps是很重要的。
Relevant Chapter: “Core App Objects”
有关章节:核心App对象
Apps Must Behave Differently in the Foreground and Background
An iOS device runs multiple apps simultaneously but only one app—the foreground app—has the user’s attention at any given time. The current foreground app is the only app allowed to present a user interface and respond to touch events. Other apps remain in the background, usually asleep but sometimes running additional code. Transitioning between the foreground and background states involves changing several aspects of your app’s behavior.
Apps比u在前台和后台表现的不同
一个IOS设备同事运行多个app,但是在任一时刻,获得用户注意的只有在前台的一个app。当前前台的app是唯一被允许显示一个用户界面并且相应触摸事件的。其他的app呆在后台,通常睡眠,但是有时候也运行一些代码。在前台后台传输状态涉及改变你的app行为的一些方面。
Relevant Chapter: “App States and Multitasking”
有关章节:App状态和多任务
iCloud Affects the Design of Your Data Model and UI Layers
iCloud allows you to share the user’s data among multiple instances of your app running on different iOS and Mac OS X devices. Incorporating support for iCloud into your app involves changing many aspects of how you manage your files. Because files in iCloud are accessible by more than just your app, all file operations must be synchronized to prevent data corruption. And depending on your app and how it presents its data, iCloud can also require changes to portions of your user interface.
iCloud影响你的数据模型和UI布局的设计
iCloud允许你在运行着你的app的多个实例的不同设备上共享用户数据。结合在你的app中支持iCloud涉及改变如何管理你的文件的很多方面。因为在iCloud中的文件不仅由你的app访问,所有的文件操作必须同步以防止数据损坏。并且取决于你的app和它如何处理它的数据,iCloud也可以要求改变你的用户接口部分。
Relevant Chapter: “iCloud Storage”
有关章节:iCloud存储
Apps Require Some Specific Resources
There are some resources that must be present in all iOS apps. Most apps include images, sounds, and other types of resources for presenting the app’s content but the App Store also requires some specific resources be present. The reason is that iOS uses several specific resources when presenting your app to the user and when coordinating interactions with other parts of the system. So these resources are there to improve the overall user experience.
Apps要求一些具体的资源
这里有一些资源必须给所有的iOS apps使用。大多数apps包括了image, sounds和其他一些类型的资源,来表达app的内容,但是App Store也要求一些具体的资源被表达。原因是iOS使用一些指定的资源,当把你的app表现给用户以及当与系统的其他部分协调交互的时候。因此这些资源是来改善整体用户体验的。
Relevant Chapter: “App-Related Resources”
有关章节:App有关的资源
Many App Behaviors Can Be Customized
The core architecture of all apps may be the same, but there are still ways for you to tweak the high-level design of your app. Some of these tweaks are how you add specific high-level features, such as data protection and URL handling. Others affect the design of specific types of apps, such as VoIP apps.
可以定制App许多的行为
所有app的核心架构都是一样的,但是仍然有一些方法让你来调整你的app的高层次设计。一些调整比如如何添加一些具体的高层特性,比如数据保护和URL处理。其他影响具体app类型的比如VoIP apps.
Relevant Chapter: “Advanced App Tricks”
有关章节:高级App技巧
Apps Must Be Tuned for Performance
Great apps are always tuned for the best possible performance. For iOS apps, performance means more than just writing fast code. It often means writing better code so that your user interface remains responsive to user input, your app does not degrade battery life significantly, and your app does not impact other system resources. Before you can tune your code, though, learn about the types of changes that are likely to provide the most benefit.
Apps必须为性能进行调整
好的apps总是为最好的性能进行调整。对于iOS apps,性能意味着不仅仅是写运行更快的代码。他常常意味着写更好的代码,因此让你的用户界面保持对用户输入的响应,你的app不会显著的减少电池的寿命,你的app不会影响到其他的系统资源。在你调整代码之前,思考,学习有可能提供最多好处的类型的变化。
Relevant Chapter: “Performance Tuning”
有关章节:调整性能
The iOS Environment Affects Many App Behaviors
There are aspects of iOS itself that impact how you design and write applications. Because iOS is built for mobile devices, it takes a more active role in providing security for apps. Other system behaviors also affect everything from how memory is managed to how the system responds to hardware input. All of these system behaviors affect the way you design your apps.
iOS环境影响着很多App的行为
这里有iOS自己的许多方面影响着你如何设计和写应用程序。因为iOS是为移动设备建立的,它扮演了一个更活跃的角色,在提供app安全中。其他系统行为也会影响来自于从如何管理钱到系统如何响应硬件输入的所有事情。所有这些系统行为都影响着你的app的设计。
Relevant Appendix: “The iOS Environment”
有关索引:iOS环境
How to Use This Document
如何使用本篇文档
This document provides important information about the core objects of your app and how they work together. This document does not address the creation of any specific type of iOS app. Instead, it provides a tour of the architecture that is common to all iOS apps and highlights key places where you can modify that architecture to meet your needs. Whenever possible, the document also offers tips and guidance about ways to implement features related to the core app architecture.
本文提供了重要信息,关于你的app的核心对象和它们之间是如何工作的。本文没有解决创建任何具体类型的iOS app。相反的,本文提供了一个浏览的架构,所有iOS app的共同点并突出的关键的地方,那些你可以修改架构来满足你的需求。只要有可能,文档也提供建议和引导,关于实现与核心应用程序架构相关的特性的方法。
Prerequisites
先决条件
This document is the main entry-point guide for designing an iOS app. This guide also covers many of the practical aspects involved with implementing your app. However, this book assumes that you have already installed the iOS SDK and configured your development environment. You must perform those steps before you can start writing and building iOS apps.
本文是设计一个iOS app的指南的主入口点。这个指南也涵盖了许多实践方面,参与实现你的app。但是,本书假设你已经安装了iOS SDK并且配置了你的开发环境。你必须在你开始写iOS apps之前完成这些步骤。
If you are new to iOS app development and want an overview of iOS development process, including information about how to configure your development environment, see App Development Overview.
如果你是一个iOS app开发新手,并且想要对iOS开发步骤有个概览,包括关于如何配置开发环境等信息,参考App Development Overview.
See Also
另请参见
For additional information related to app design, see the following documents:
对于app设计有短的信息,请参考下面的文档:
For guidance about how to design an iOS app, read iOS Human Interface Guidelines. This book provides you with tips and guidance about how to create a great experience for users of your app. It also conveys the basic design philosophy surrounding iOS apps.
对于如何设计一个iOS app的指南,阅读iOS Human Interface Guidelines.
这本书为你提供了建议和指南,关于如何创建一个具有良好用户体验的app。他也传达了iOS app相关的设计理念。
If you are not sure what is possible in an iOS app, read iOS Technology Overview. This book provides a summary of iOS technologies and the situations where you might want to use them. This book is not required reading but is a good reference during the brainstorming phase of your project.
如果你不确定什么可以放到iOS app里面去,阅读iOS Technology Overview.
这本书提供了一个iOS技术和情况的汇总,你可能想要使用它们。本书不是要求阅读的,但是在你的项目集思广益的阶段是一个很好的参考。
If you are interested in a more hands-on approach to creating iOS apps, you should read Your First iOS App. This tutorial walks you through the app-creation process from start to finish, showing you how to create a simple app and get it running.
如果你对创建iOS app的实用方法更感兴趣,你应该阅读Yourr First iOS App。这个教程带你遍历了app从开始到结束的创建过程。为你展示如何创建一个简单的app并且让它运行起来。
关于IOS App编程
This document is the starting point for creating iOS apps. It describes the fundamental architecture of iOS apps, including how the code you write fits together with the code provided by iOS. This document also offers practical guidance to help you make better choices during your design and planning phase and guides you to the other documents in the iOS developer library that contain more detailed information about how to address a specific task.
本文是创建一个IOS应用程序的起点。本文描述了IOS应用程序的基础架构,包括了你如何写与IOS提供的代码相结合的代码。本文也提供了实践指导来帮助你在设计和计划阶段更好的做决定,并且指导你去参考IOS开发库中其他的文档,那些文档里包含了关于解决一个问题的更详细的信息。
The contents of this document apply to all iOS apps running on all types of iOS devices, including iPad, iPhone, and iPod touch.
文本的内容适用于运行于所有IOS设备的所有程序,包括iPad,iPhone和iPod touch.
Note: Development of iOS apps requires an Intel-based Macintosh computer with the iOS SDK installed.
注意:IOS应用程序的开发需要一个装有Macintosh系统的计算机并且安装了IOS SDK。
At a Glance
概览
The starting point for any new app is identifying the design choices you need to make and understanding how those choices map to an appropriate implementation.
任何新app的起点是确定设计选择,你需要理解并且做这些选择如何映射到一个合适的实现方法上。
Translate Your Initial Idea into an Implementation Plan
把你最初的想法翻译成一个可实行的计划
Every great iOS app starts with a great idea, but translating that idea into actions requires some planning. Every iOS app relies heavily on design patterns, and those design patterns influence much of the code you need to write. So before you write any code, take the time to explore the possible techniques and technologies available for writing that code. Doing so can save you a lot of time and frustration.
每一个好的应用程序都有一个好的想法,但是把这些想法翻译成为具体的行为需要一些锻炼。每个应用程序严重的依赖于设计模式,这些设计模式影响到了你需要写多少代码。因此,在你写代码之前,花点时间来探索可能的技术和写这些代码有效的技术。这样做可以为你节省许多时间和少遇到很多挫折。
Relevant Chapter: “App Design Basics”
有关章节:App设计基础
UIKit Provides the Core of Your App
The core infrastructure of an iOS app is built from objects in the UIKit framework. The objects in this framework provide all of the support for handling events, displaying content on the screen, and interacting with the rest of the system. Understanding the role these objects play, and how you modify them to customize the default app behavior, is therefore very important for writing apps quickly and correctly.
UIKit为你的App提供了核心
一个iOS app的核心基础是内置UIKit框架中的对象。这个框架中的对象提供了对处理事件、显示屏幕内容和与系统交互都提供了支持。理解这些对象扮演的角色,并且理解你修改他们将如何影响到app的行为,因此对于更快更正确的写apps是很重要的。
Relevant Chapter: “Core App Objects”
有关章节:核心App对象
Apps Must Behave Differently in the Foreground and Background
An iOS device runs multiple apps simultaneously but only one app—the foreground app—has the user’s attention at any given time. The current foreground app is the only app allowed to present a user interface and respond to touch events. Other apps remain in the background, usually asleep but sometimes running additional code. Transitioning between the foreground and background states involves changing several aspects of your app’s behavior.
Apps比u在前台和后台表现的不同
一个IOS设备同事运行多个app,但是在任一时刻,获得用户注意的只有在前台的一个app。当前前台的app是唯一被允许显示一个用户界面并且相应触摸事件的。其他的app呆在后台,通常睡眠,但是有时候也运行一些代码。在前台后台传输状态涉及改变你的app行为的一些方面。
Relevant Chapter: “App States and Multitasking”
有关章节:App状态和多任务
iCloud Affects the Design of Your Data Model and UI Layers
iCloud allows you to share the user’s data among multiple instances of your app running on different iOS and Mac OS X devices. Incorporating support for iCloud into your app involves changing many aspects of how you manage your files. Because files in iCloud are accessible by more than just your app, all file operations must be synchronized to prevent data corruption. And depending on your app and how it presents its data, iCloud can also require changes to portions of your user interface.
iCloud影响你的数据模型和UI布局的设计
iCloud允许你在运行着你的app的多个实例的不同设备上共享用户数据。结合在你的app中支持iCloud涉及改变如何管理你的文件的很多方面。因为在iCloud中的文件不仅由你的app访问,所有的文件操作必须同步以防止数据损坏。并且取决于你的app和它如何处理它的数据,iCloud也可以要求改变你的用户接口部分。
Relevant Chapter: “iCloud Storage”
有关章节:iCloud存储
Apps Require Some Specific Resources
There are some resources that must be present in all iOS apps. Most apps include images, sounds, and other types of resources for presenting the app’s content but the App Store also requires some specific resources be present. The reason is that iOS uses several specific resources when presenting your app to the user and when coordinating interactions with other parts of the system. So these resources are there to improve the overall user experience.
Apps要求一些具体的资源
这里有一些资源必须给所有的iOS apps使用。大多数apps包括了image, sounds和其他一些类型的资源,来表达app的内容,但是App Store也要求一些具体的资源被表达。原因是iOS使用一些指定的资源,当把你的app表现给用户以及当与系统的其他部分协调交互的时候。因此这些资源是来改善整体用户体验的。
Relevant Chapter: “App-Related Resources”
有关章节:App有关的资源
Many App Behaviors Can Be Customized
The core architecture of all apps may be the same, but there are still ways for you to tweak the high-level design of your app. Some of these tweaks are how you add specific high-level features, such as data protection and URL handling. Others affect the design of specific types of apps, such as VoIP apps.
可以定制App许多的行为
所有app的核心架构都是一样的,但是仍然有一些方法让你来调整你的app的高层次设计。一些调整比如如何添加一些具体的高层特性,比如数据保护和URL处理。其他影响具体app类型的比如VoIP apps.
Relevant Chapter: “Advanced App Tricks”
有关章节:高级App技巧
Apps Must Be Tuned for Performance
Great apps are always tuned for the best possible performance. For iOS apps, performance means more than just writing fast code. It often means writing better code so that your user interface remains responsive to user input, your app does not degrade battery life significantly, and your app does not impact other system resources. Before you can tune your code, though, learn about the types of changes that are likely to provide the most benefit.
Apps必须为性能进行调整
好的apps总是为最好的性能进行调整。对于iOS apps,性能意味着不仅仅是写运行更快的代码。他常常意味着写更好的代码,因此让你的用户界面保持对用户输入的响应,你的app不会显著的减少电池的寿命,你的app不会影响到其他的系统资源。在你调整代码之前,思考,学习有可能提供最多好处的类型的变化。
Relevant Chapter: “Performance Tuning”
有关章节:调整性能
The iOS Environment Affects Many App Behaviors
There are aspects of iOS itself that impact how you design and write applications. Because iOS is built for mobile devices, it takes a more active role in providing security for apps. Other system behaviors also affect everything from how memory is managed to how the system responds to hardware input. All of these system behaviors affect the way you design your apps.
iOS环境影响着很多App的行为
这里有iOS自己的许多方面影响着你如何设计和写应用程序。因为iOS是为移动设备建立的,它扮演了一个更活跃的角色,在提供app安全中。其他系统行为也会影响来自于从如何管理钱到系统如何响应硬件输入的所有事情。所有这些系统行为都影响着你的app的设计。
Relevant Appendix: “The iOS Environment”
有关索引:iOS环境
How to Use This Document
如何使用本篇文档
This document provides important information about the core objects of your app and how they work together. This document does not address the creation of any specific type of iOS app. Instead, it provides a tour of the architecture that is common to all iOS apps and highlights key places where you can modify that architecture to meet your needs. Whenever possible, the document also offers tips and guidance about ways to implement features related to the core app architecture.
本文提供了重要信息,关于你的app的核心对象和它们之间是如何工作的。本文没有解决创建任何具体类型的iOS app。相反的,本文提供了一个浏览的架构,所有iOS app的共同点并突出的关键的地方,那些你可以修改架构来满足你的需求。只要有可能,文档也提供建议和引导,关于实现与核心应用程序架构相关的特性的方法。
Prerequisites
先决条件
This document is the main entry-point guide for designing an iOS app. This guide also covers many of the practical aspects involved with implementing your app. However, this book assumes that you have already installed the iOS SDK and configured your development environment. You must perform those steps before you can start writing and building iOS apps.
本文是设计一个iOS app的指南的主入口点。这个指南也涵盖了许多实践方面,参与实现你的app。但是,本书假设你已经安装了iOS SDK并且配置了你的开发环境。你必须在你开始写iOS apps之前完成这些步骤。
If you are new to iOS app development and want an overview of iOS development process, including information about how to configure your development environment, see App Development Overview.
如果你是一个iOS app开发新手,并且想要对iOS开发步骤有个概览,包括关于如何配置开发环境等信息,参考App Development Overview.
See Also
另请参见
For additional information related to app design, see the following documents:
对于app设计有短的信息,请参考下面的文档:
For guidance about how to design an iOS app, read iOS Human Interface Guidelines. This book provides you with tips and guidance about how to create a great experience for users of your app. It also conveys the basic design philosophy surrounding iOS apps.
对于如何设计一个iOS app的指南,阅读iOS Human Interface Guidelines.
这本书为你提供了建议和指南,关于如何创建一个具有良好用户体验的app。他也传达了iOS app相关的设计理念。
If you are not sure what is possible in an iOS app, read iOS Technology Overview. This book provides a summary of iOS technologies and the situations where you might want to use them. This book is not required reading but is a good reference during the brainstorming phase of your project.
如果你不确定什么可以放到iOS app里面去,阅读iOS Technology Overview.
这本书提供了一个iOS技术和情况的汇总,你可能想要使用它们。本书不是要求阅读的,但是在你的项目集思广益的阶段是一个很好的参考。
If you are interested in a more hands-on approach to creating iOS apps, you should read Your First iOS App. This tutorial walks you through the app-creation process from start to finish, showing you how to create a simple app and get it running.
如果你对创建iOS app的实用方法更感兴趣,你应该阅读Yourr First iOS App。这个教程带你遍历了app从开始到结束的创建过程。为你展示如何创建一个简单的app并且让它运行起来。