iOS学习笔记(6)——翻译苹果文档About Windows and Views
About Windows and Views
关于窗口和视图
In iOS, you use windows and views to present your application’s content on the screen. Windows do not have any visible content themselves but provide a basic container for your application’s views. Views define a portion of a window that you want to fill with some content. For example, you might have views that display images, text, shapes, or some combination thereof. You can also use views to organize and manage other views.
在iOS中,你用窗口和视图来在屏幕上呈现你应用内容。窗口本身并不拥有任何可见的内容,而是为你的应用视图提供了基本的容器。视图定义了你想要填充某些内容到窗口中的一部分。例如,你很可能拥有能够显示图片、文字、形状活着某些组合的视图。你同样可以使用视图去组织和管理其他视图。
At a Glance
一瞥
Every application has at least one window and one view for presenting its content. UIKit and other system frameworks provide predefined views that you can use to present your content. These views range from simple buttons and text labels to more complex views such as table views, picker views, and scroll views. In places where the predefined views do not provide what you need, you can also define custom views and manage the drawing and event handling yourself.
每一个应用拥有至少一个窗口和一个视图去显示他的内容。 UIKit和其他的系统框架提供预定义的视图,你可以利用它们显示你的内容。这些视图囊括了从简单的按钮、文本标签到复杂的表视图、选择器视图以及滚动视图。在某些场合中,这些与定义的视图不能够满足你的需要,你还可以自定义视图,并且自己管理那些绘图和事件。
Views Manage Your Application’s Visual Content
视图管理你应用的可视内容
A view is an instance of the UIView
class (or one of its subclasses) and manages a rectangular area in your application window. Views are responsible for drawing content, handling multitouch events, and managing the layout of any subviews. Drawing involves using graphics technologies such as Core Graphics, OpenGL ES, or UIKit to draw shapes, images, and text inside a view’s rectangular area. A view responds to touch events in its rectangular area either by using gesture recognizers or by handling touch events directly. In the view hierarchy, parent views are responsible for positioning and sizing their child views and can do so dynamically. This ability to modify child views dynamically lets your views adjust to changing conditions, such as interface rotations and animations.
一个视图是一个UIView类(或者一个它子类)的实例,并且管理一块在你应用窗口中的矩形区域。视图负责绘图内容、操控多点触控事件以及管理任何子视图的层。绘图使用了图形技术,诸如 Core Graphics, OpenGL ES, 或者 UIKit等,用来在一个视图的矩形区域内绘制图形、图像以及文本。一个视图在它的矩形区域中,通过使用手势识别或直接操作触控事件来响应触碰事件。在视图的等级层次中,父视图负责它们子视图的定位和尺寸,并且可以动态地这样做。这个能力动态地修改你的子视图,让你的视图在诸如界面旋转和动画过渡的变化条件下自适应。
You can think of views as building blocks that you use to construct your user interface. Rather than use one view to present all of your content, you often use several views to build a view hierarchy. Each view in the hierarchy presents a particular portion of your user interface and is generally optimized for a specific type of content. For example, UIKit has views specifically for presenting images, text and other types of content.
你可以将视图看作是你用来建设你的用户界面的构建区块。你通常会使用多个视图去创建一个视图层,而不是仅使用一个视图展现你所有的内容。在层中的每一个视图,展示了你用户的界面的独有的一部分,并且普遍是对特定类型的优化。例如, UIKit 拥有专门为显示图像、文本以及其它类型内容的视图。
Windows Coordinate the Display of Your Views
窗口协调你视图的显示
A window is an instance of the UIWindow
class and handles the overall presentation of your application’s user interface. Windows work with views (and their owning view controllers) to manage interactions with, and changes to, the visible view hierarchy. For the most part, your application’s window never changes. After the window is created, it stays the same and only the views displayed by it change. Every application has at least one window that displays the application’s user interface on a device’s main screen. If an external display is connected to the device, applications can create a second window to present content on that screen as well.
一个窗口是一个UIWindow类的实例,并且管理你应用用户界面的整体外观。窗口与视图(以及视图自己所属的视图控制器)一同工作,以用来管理与可见视图层的交互以及改变。最重要的一点,你应用的窗口永远不会改变。在窗口被创建之后,它始终保持相同,并且只有视图通过改变来显示。每一个应用至少拥有一个窗口,用来在设备的主屏幕上显示应用的用户界面。如果一个额外的显示界面被连接到设备,应用能够创建第二个窗口来在同一个屏幕上呈现内容。
Animations Provide the User with Visible Feedback for Interface Changes
动画为用户对界面改变提供可视化的反馈
Animations provide users with visible feedback about changes to your view hierarchy. The system defines standard animations for presenting modal views and transitioning between different groups of views. However, many attributes of a view can also be animated directly. For example, through animation you can change the transparency of a view, its position on the screen, its size, its background color, or other attributes. And if you work directly with the view’s underlying Core Animation layer object, you can perform many other animations as well.
动画对你视图层的改变,为用户提供可视化的反馈。系统为呈现模型视图以及在不同视图组织间变化定义标准动画。然而,很多视图的属性同样能直接靠动画改变。例如,通过动画你能够改变视图它的的透明度、它在屏幕上的位置、它的大小、他的背景颜色,或者其他属性。并且,如果你直接用视图潜在的Core Animation 层对象,你同样能够展示很多其他动画。
The Role of Interface Builder
Interface Builder的作用
Interface Builder is an application that you use to graphically construct and configure your application’s windows and views. Using Interface Builder, you assemble your views and place them in a nib file, which is a resource file that stores a freeze-dried version of your views and other objects. When you load a nib file at runtime, the objects inside it are reconstituted into actual objects that your code can then manipulate programmatically.
Interface Builder是一个你用来图形化创建以及配置你应用的窗口和视图的应用。使用Interface Builder,你组合你的视图并且将它们放置在一个nib文件中,nib文件是一种储存了一个你视图和其他对象的不变版本的资源文件。当你在运行时加载一个nib文件时,在它里面的对象都被改组到一个真实的对象中,从而你的代码在那之后能够程序化地操作。
Interface Builder greatly simplifies the work you have to do in creating your application’s user interface. Because support for Interface Builder and nib files is incorporated throughout iOS, little effort is required to incorporate nib files into your application’s design.
Interface Builder极大地简化了你在创建你应用的用户界面时不得不做的工作。由于对Interface Builder 和 nib文件的支持合并到iOS中,只需要花费很少的努力就能讲nib文件合并到你应用的设计中去。
For more information about how to use Interface Builder, see Interface Builder User Guide. For information about how view controllers manage the nib files containing their views, see Creating Custom Content View Controllers in View Controller Programming Guide for iOS.
对于更多关于如何使用Interface Builder的信息,参见Interface Builder User Guide。对于视图控制器如何管理nib文件来容纳它们的视图,参见Creating Custom Content View Controllers in View Controller Programming Guide for iOS.
See Also
同样参见
Because views are very sophisticated and flexible objects, it would be impossible to cover all of their behaviors in one document. However, other documents are available to help you learn about other aspects of managing views and your user interface as a whole.
View controllers are an important part of managing your application’s views. A view controller presides over all of the views in a single view hierarchy and facilitates the presentation of those views on the screen. For more information about view controllers and the role they play, see View Controller Programming Guide for iOS.
Views are the key recipients of gesture and touch events in your application. For more information about using gesture recognizers and handling touch events directly, see Event Handling Guide for iOS.
Custom views must use the available drawing technologies to render their content. For information about using these technologies to draw within your views, see Drawing and Printing Guide for iOS.
In places where the standard view animations are not sufficient, you can use Core Animation. For information about implementing animations using Core Animation, see Core Animation Programming Guide
iOS学习笔记(6)——翻译苹果文档About Windows and Views的更多相关文章
- SpringBoot学习笔记:Swagger实现文档管理
SpringBoot学习笔记:Swagger实现文档管理 Swagger Swagger是一个规范且完整的框架,用于生成.描述.调用和可视化RESTful风格的Web服务.Swagger的目标是对RE ...
- AngularJS1.X学习笔记14-动画(解读文档)
最近在看算法分析,那个大O啊,小o啊,分治法啊(目前就看到这里),真是搞死了.这回呢休息一下,学学AngularJS动画,上一篇文章根据自由男人的书简单谈到了动画的话题,发现反响很大(好吧,我说慌了, ...
- MongoDB学习笔记四—增删改文档下
$slice 如果希望数组的最大长度是固定的,那么可以将 $slice 和 $push 组合在一起使用,就可以保证数组不会超出设定好的最大长度.$slice 的值必须是负整数. 假设$slice的值为 ...
- MongoDB学习笔记三—增删改文档上
插入insert 单条插入 > db.foo.insert({"bar":"baz"}) WriteResult({ }) 批量插入 > db.fo ...
- JavaScript学习笔记7 之DOM文档对象模型
一.什么是DOMDocument Object Model 文档 -------对象 ----模型-------缩写DOM DOM是针对HTML和XML文档的一个API(应用程序编程接口).DOM描绘 ...
- HTML&CSS基础学习笔记1.4-定义文档类型
Web 世界中存在许多不同的文档.只有了解文档的类型,浏览器才能正确地显示文档. HTML 也有多个不同的版本,只有完全明白页面中使用的确切 HTML 版本,浏览器才能完全正确地显示出 HTML 页面 ...
- 《DOM Scripting》学习笔记-——第八章 充实文档的内容
本章内容 一.一个为文档创建“缩略词语表”的函数 二.一个为文档创建“文献来源链接”的函数 三.一个为文档创建“快速访问键清单”的函数 利用DOM动态的收集和创建一些有用的辅助信息,并把它们呈现在网页 ...
- MongoDB快速入门学习笔记3 MongoDB的文档插入操作
1.文档的数据存储格式为BSON,类似于JSON.MongoDB插入数据时会检验数据中是否有“_id”,如果没有会自动生成.shell操作有insert和save两种方法.当插入一条数据有“_id”值 ...
- latex学习笔记----基本知识、文档排版
1.空格和制表符等空白字符视为相同的空白距离,多个连续的空白字符等同为一个字符. 2.# $ % ^ _ { } ~ 在这些字符前面加上反斜线,就可以在文本中得到它们. 反斜线\不 ...
随机推荐
- jquery相对定位(包含find的使用 find相当于后代选择器)$("选择器1","选择器2")
- Java设计模式(4)——单例模式
转载:http://wiki.jikexueyuan.com/project/java-design-pattern/singleton-pattern.html 单例模式根据实例化对象时机的不同分为 ...
- 数据挖掘分类算法之决策树(zz)
决策树(Decision tree) 决策树是以实例为基础的归纳学习算法. 它从一组无次序.无规则的元组中推理出决策树表示形式的分类规则.它采用自顶向下的递归方式,在决策树的内部结点进行属性值 ...
- Linux的进程与服务(二)
1.查看进程 ps - processes snapshot ps aue ps -elf [root@localhost ~]# ps aue USER PID %CPU %MEM VSZ RSS ...
- 一款好用的js插件及工具包
笔记:需要源码私信 script文件夹 script下的目录文件: 使用的效果,解决ie兼容性问题,好处多多!慢慢参考! 具体用法: 前端引入js,写必须要的js脚本! <script src= ...
- Oracle FND API–Create User
--API - fnd_user_pkg.createuser----Example -- -- ---------------------------------------- API to CRE ...
- Sharepoint安装的几处注意事项
0.sharepoint自带组件安装,无需另下载安装 1.必须安装域(不安装会提示sharepoint 指定的用户是本地账户) 2.域安装后需要在sharepoint设置的数据库账号具有域权限及高级权 ...
- freemarker获取变量的范围的问题
今天做freemarker的时候,想用一下全局的变量.就是在a.ftl 和 b.ftl页面里面,使用a.action里面放入request的变量.a.action的视图页面是a.ftl ,b.ftl是 ...
- visual studio code中使用emmet插件在.vue文件失效
使用visual studio code编辑.vue文件时,emmet插件无法使用,可以通过以下两种试解决: 1.文件→设置,在右侧窗口添加以下代码: "emmet.syntaxProfil ...
- wp调用百度服务api
通过百度开放平台申请api成功后,百度会提供一个application key简称ak和一个security key简称sk. 看一下某个服务url的格式 1. url前缀 2. 服务类型 3. 参数 ...