【转载】iPhone系统概览
iPhone OS Overview
iPhone系统概览
iPhone OS comprises the operating system and technologies that you use to run applications natively on iPhone and iPod touch devices. Although it shares a common heritage and many underlying technologies with Mac OS X, iPhone OS was designed to meet the needs of a mobile environment, where user’s needs are slightly different. Existing Mac OS X developers will find many familiar technologies, but they’ll also find technologies that are available only on iPhone OS, such as the Multi-Touch interface and accelerometer support.
iPhone系统由操作系统和技术组成,你使用它们在iPhone和iPod touch设备上运行本地应用程序。尽管它共用了一些Mac OS X的传统和底层技术,但iPhone系统被设计成满足移动环境的需求,这种环境中用户的需求有些不同。原先的Mac OS X开发者会发现许多熟悉的技术,但他们也会发现iPhone系统专有的技术,如多点触摸介面和加速度计支持。
The iPhone SDK contains the code, information, and tools you need to develop, test, run, debug, and tune applications for the iPhone OS. The Xcode tools have been updated to support development for the iPhone OS. In addition to providing the basic editing, compilation, and debugging environment for your code, Xcode also provides the launching point for testing your applications on an iPhone or iPod touch device. Xcode also lets you run applications in iPhone simulator, a platform that mimics the basic iPhone OS environment on your local Macintosh computer.
iPhone的SDK包括开发,测试,运行,调试iPhone应用程序的代码,信息和工具。Xcode工具已经支持iPhone程序开发。除了提供代码编辑,编译和调试的环境,Xcode也提供程序在iPhone和iPod touch设备上的调试功能。Xcode也可以在iPhone模拟器上运行程序,模拟器在苹果机上实现对iPhone系统环境的模拟。
This article provides a high-level overview of the basic features found in iPhone OS, to help orient you to the platform. You’ll find other articles in the iPhone Dev Center to help get you up to speed quickly and to help you understand the basic process for creating iPhone applications. You should use these articles to help guide your learning path for iPhone OS.
本文提供高级的iPhone系统基本特征的概览,将你引向iPhone开台。你可以在iPhone开发网站找到其他文档帮你快速了解基本的iPhone程序开发过程。你应该使用这些文档帮助你学习iPhone系统。
Contents:
iPhone OS Technology Layers
Writing Code for iPhone OS
Where to Start
内容:
iPhone系统的技术层次
为iPhone系统写代码
从何开始
iPhone OS Technology Layers
iPhone系统的技术层次
In iPhone OS, the underlying system architecture, and many of the technologies, are similar to those found in Mac OS X. The kernel in iPhone OS is based on a variant of the same basic Mach kernel that is found in Mac OS X. On top of this kernel are the layers of services that are used to implement applications on the platform. Figure 1-1 shows a high-level overview of these layers.
iPhone系统的底层系统构架和许多技术与MacOSX相似。iPhone系统的内核是基于MacOSX的Mach内核的变种。内核的最上层是实现应用的服务层。图1-1显示这些层次的概貌。
Figure 1-1 iPhone OS technology layers
图1-1 iPhone系统的技术层次
This layering gives you choices when it comes to implementing your code. For example, the Core OS and Core Services layers contain the fundamental interfaces for iPhone OS, including those used for accessing files, low-level data types, Bonjour services, network sockets, and so on. These interfaces are mostly C-based and include technologies such as Core Foundation, CFNetwork, SQLite, and access to POSIX threads and UNIX sockets among others.
这些层次给你实现代码提供了选择。例如,Core OS 和Core Services层包括了文件访问,低级数据类型,Bonjour服务,网络套接字等iPhone系统的基础接口,这些接口绝大部分是基于C的,包括Core Foundation, CFNetwork, SQLite, 访问POSIX线程和UNIX套接字等技术。
As you move into the upper layers, you find more advanced technologies that use a mixture of C-based and Objective-C based interfaces. For example, the Media layer contains the fundamental technologies used to support 2D and 3D drawing, audio, and video. This layer includes the C-based technologies OpenGL ES, Quartz, and Core Audio. It also contains Core Animation, which is an advanced Objective-C based animation engine.
往上面的层是基于C和基于Objective-C接口的技术。例如Media层包括用来支持2D、3D绘图,音频,视频的基础技术。此层基于C的OpenGL ES, Quartz和Core Audio技术,也包括Core Animation技术,它是一种基于Objective-C的高级动画引擎。
In the Cocoa Touch layer, most of the technologies use Objective-C. The frameworks at these layers provide the fundamental infrastructure used by your application. For example, the Foundation framework provides object-oriented support for collections, file management, network operations, and more. The UIKit framework provides the visual infrastructure for your application, including classes for windows, views, controls, and the controllers that manage those objects. Other frameworks at this level give you access to the user’s contact and photo information and to the accelerometers and other hardware features of the device.
Cocoa Touch层大部分的技术基于Objective-C。这层的框架提供你的应用的基本结构。例如,Foundation框架提供集合的对象支持,文件管理,网络操作等。UIKit框架提供你的应用的视觉结构,包括窗口、视图、控件类和管理对象的控制器。这个层的其他框架让你可以访问用户联系表,图片,加速度计和设备的其他硬件功能。
The starting point for any new project is the Cocoa Touch layer, and the UIKit framework in particular. When deciding what additional technologies to use, it is recommended that you start with frameworks in the higher-level layers and fall back on the frameworks in the lower layers as needed. The higher-level frameworks make it easy to support standard system behaviors with the least amount of effort on your part. The only time you should fall back to the lower-level frameworks is when you want to implement custom behavior that is not provided at a higher level.
任何新工程的开始点都在Cocoa Touch层,特别是UIKit框架。开发时,应该先从高级层的框架开始,有必要时再使得低级的层框架。高级层可简化对标准系统功能的使用。只有当你要实现高级层没有提供的功能时再访问低级层。
For a more detailed overview of the technologies in iPhone OS, see iPhone OS Technology Overview.
要了解iPhone系统技术的详细内容,请参阅文档:iPhone OS Technology Overview。
Writing Code for iPhone OS
为iPhone系统写代码
The iPhone SDK supports the creation of graphically-oriented applications that run natively in iPhone OS. The applications you create reside on the user’s Home screen, along with the other system applications, such as Photos, Weather, and Clock. After it is launched, aside from the kernel and a few low-level daemons, your application is the only application running on the system. While running, your application occupies the entire screen and is the focus of the user’s attention. And when the user presses the Home button, your application quits and the system displays the Home screen again. Having the system to yourself is advantageous because it gives you full access to the underlying system resources. You can take advantage of built-in hardware such as the accelerometers, camera, and graphics hardware to run just your code.
iPhoneSDK可创建运行于iPhone系统的图形化本地程序。你创建的程序位于用户主屏上,与其他系统程序如照片、天气和时钟在一起。程序启动后,除了系统内核和一少量的后台进程外,你的程序是系统唯一运行的程序。程序运行时占据整个屏幕,用户的注意力都在上面。当用户按Home键时,你的程序退出,系统又显示主屏。你的程序安全占有系统的好处是可以完全访问系统的低层资源。你的程序可以利用内建的硬件如加速度计,摄像头和绘图硬件。
Because the way users interact with iPhone and iPod touch devices is fundamentally different from the way users interact with Mac OS X, the way you design your applications must also be different. In an iPhone application, there is no concept of separate document windows for displaying content. Instead, all of the application’s data is displayed in a single window. This has lead to the creation of new views and controls that allow you to present your application’s data in an organized manner. In addition, many of the standard views and controls may behave a little differently than their Mac OS X counterparts. Most of these changes should be transparent but some may require you to rethink the way you organize and present your data.
因为用户与iPhone和iPod touch设备交互的方式与MacOSX的不同,所以程序的设计方式也不同。在iPhone程序中,没有显示内容的分离文档窗口的概念,所有的程序数据只显示在一个单独的窗口。这使用新的表现程序数据的视图和控件要按组织的方式来创建。并且,许多标准的视图的控件与MacOSX中的行为不同。大部分的改变是很明白的,但有一些需要你重新考虑你组织和表现数据的方式。
The event-handling model in iPhone OS also represents a significant departure from traditional desktop applications. Instead of relying on the traditional mouse and keyboard events, iPhone OS introduces the idea of touch events. A touch event can occur at any time and in combination with one or more additional touch events. Touches can be used to detect simple interactions with content, such as selecting or dragging items, or they can be used to detect complex gestures and interactions, such as swipes or the pinch-open and pinch-close gestures (used, for example, to zoom in and out in the Photos application).
iPhone系统的事件处理模型也与传统的桌面程序不同。不再依赖传统的鼠标、键盘事件,iPhone系统引入了触摸事件。触摸事件可以在任何时候发生,可以与一个或多个事件组合。触摸可用来探测简单的联系表交互,如选择或拖掇项目,也可能来探测的手势交互,如划屏,放大和缩小手势(如用在照片程序中这么大缩小照片)。
Beyond considering the basic structure of your application, you need to think about how users will actually use it. iPhone applications should be clean, and focused on what the user needs in the moment. Remember that users who are on-the-go want to get at information quickly and not spend a lot of time looking digging through several layers of screens. Providing a simple layout that highlights the key information the user needs is important. For games and other fun applications, you should also consider how the users might want to interact with your application and take advantage of technologies such as the accelerometers and camera where appropriate.
除了考虑程序的基本结构外,你还要考虑用户如何实际使用程序。iPhone程序应该是简洁的,关注用户的需求。记住用户忙的时候要很快速找到信息,不会想花费很多时间在多层程序中寻找。提供一个可以突显用户需要的关键信息的界面布局很重要。对游戏和其他有意思的程序,你要考虑用户怎样同你的程序交互,要利用如加速度计和摄像头的技术。
As you start development, the frameworks you want to use initially are the Foundation and UIKit frameworks. These frameworks provide the key services used by all iPhone applications. As you refine your application, you should investigate the other frameworks in the system to see what services they offer. The documentation for each framework includes links to relevant conceptual materials to help you learn more about how to use that framework.
开始开发程序时,你最先使用的框架是Foundation和UIKit。这些框架提供iPhone程序使用的关键服务。如果要扩展你的程序,你应该了解一下系统其他的框架提供了什么服务。每一个框架的文档提供使用框架的相关概念性材料。
For information about the Foundation and UIKit frameworks, see Foundation Framework Reference andUIKit Framework Reference.
了解Foundation和UIKit框架,请参阅文档:Foundation Framework Reference ,UIKit Framework Reference。
Where to Start
从何开始
Creating simple applications that run on iPhone OS is relatively easy with the built-in project templates provided by Xcode, but creating applications that do something useful and look nice requires you to spend some time reading through the available documentation. At a minimum, you should take the time to read through the other orientation articles in the iPhone Dev Center, which explore the tools and process for creating applications.
使用Xcode内置的工程模板来创建简单的iPhone程序相对容易,但要创建有用的界面好看的程序要求你要时间通读所有文档。至少你要花时间通读iPhone开发网站的其他培训文档,如使用开发工具和创建程序的流程。
If you are completely new to iPhone OS and to Mac OS X, taking the time to understand the basic design patterns and conventions of iPhone OS is critical to writing code for the platform. Applications operate best in iPhone OS when they take advantage of the power the frameworks provide. If you spend time trying to work around the basic framework behaviors, you may find creating your application much more difficult than simply learning the basic design patterns in use. The basic information that every iPhone developer needs to know is in Cocoa Fundamentals Guide. This document covers the basics of the Objective-C language and the programming conventions and design patterns used by UIKit and many other system frameworks.
如果你未开发过iPhone和MacOS程序,花时间理解iPhone系统基本的设计模式和约定对写代码是很重要的。程序利用了框架提供的强大功能才能运行良好。如果你花时间试着与以基本的框架行为为主而进行开发工作,你会发现你的程序在使用时与简单的学习基本的设计模式有很大的不同。iPhone开发者需要知道的基本信息在文档:Cocoa Fundamentals Guide。此文档包括了Objective-C语言的基础,编程约定,UIKit和许多其他系统框架使用的设计模式。
Once you understand the basic conventions you use to create iPhone applications, you can refer toiPhone Application Programming Guide for specific details on the development process. This book provides key conceptual and task-based information on how to write iPhone applications, including examples of how to display a user interface, handle events, and take advantage of key iPhone OS features. It also describes the overall development process and explains how you use Xcode to build and run your applications.
当你理解了创建iPhone程序的基本的约定后,你可以参阅文档iPhone Application Programming Guide来了解开如过程的细节。此文档提供如何开发iPhone程序的关键的概念性和基于任务的信息,包括一些如何显示用户界面,处理事件和利用iPhone程序关键功能的例子。它也描述开发的整个过程,解释如何使得Xcode和编译和运行程序。
In addition to iPhone Application Programming Guide, you should also look through the available sample code. iPhone OS ships with a number of full-featured samples that show you how to use the available technologies to create real-world applications. You can use these samples as a starting point for your own applications or you can look at them to learn more about how you use specific features.
除了上述文档外,你应该看一些例子代码。iPhone系统有大量包括多种功能的例子,它们可让你明白怎样使用技术去创建真实的应用。你可以以这些例子为起点来开发你自己的程序,也可以从中学习如何使用特定的功能。
作者:
出处:http://www.cnblogs.com/ChenYilong/(点击RSS订阅)
本文版权归作者和博客园共有,欢迎转载,
但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。