Collection View Programming Guide for iOS---(一)----About iOS Collection Views
About iOS Collection Views
关于iOS Collection Views
A collection view is a way to present an ordered set of data items using a flexible and changeable layout. The most common use for collection views is to present items in a grid-like arrangement, but collection views in iOS are capable of more than just rows and columns. With collection views, the precise layout of visual elements is definable through subclassing and can be changed dynamically. So you can implement grids, stacks, circular layouts, dynamically changing layouts, or any type of arrangement you can imagine.
collection view 是运用一个灵活多变的布局呈现一系列有序数据项的一种方法。collection view最通常的使用使用像网格状排列来呈现数据项,但是iOS的collection view 的能力不仅限于行和列。使用collection views, 视觉元素的精确布局可通过子类化定义并被动态改变。所以你可以实现网格,栈,圆形布局,动态改变布局,或任何你可以想象的排列布局。
Collection views keep a strict separation between the data being presented and the visual elements used to present that data. Your app is solely responsible for managing the data. Your app also provides the view objects used to present that data. After that, the collection view takes your views and does all the work of positioning them onscreen. It does this work in conjunction with a layout object, whose job is to specify the placement and visual attributes for your views. Thus, you provide the data, the layout object provides the placement information, and the collection view merges the two pieces together to achieve the final appearance.
Collection views 严格分离被呈现的数据和用来呈现这些数据的视觉元素。应用程序只负责管理这些数据,以及提供用来呈现这些数据的视图对象。然后collection view接手这些视图,并完成所有的工作把数据定位在屏幕上。它和一个层对象(layout object)联合工作,该层对象的工作是指定视图的位置和可视化属性。因此,你提供数据,层对象提供位置信息,collection view 把这两部分融合在一起来达到最后的外观。
At a Glance(概览)
The standard iOS collection view classes provide all of the behavior you need to implement simple grids. You can also extend the standard classes to support custom layouts and specific interactions with those layouts.
标准iOS collection view 类提供了实现简单网格的所有行为(behavior)。你也可以扩展标准类来支持自定义布局,来实现跟那些布局的特殊交互。
A Collection View Manages the Visual Presentation of Data Driven Views
Collection View 管理驱动视图的可视化数据呈现
A collection view facilitates the presentation of data-driven views provided by your app. The collection view’s only concern is about taking your views and laying them out in a specific way. The collection view is all about the presentation and arrangement of your views and not about their content. Understanding the interactions between the collection view, the layout object, and your custom objects is crucial for using collection views in your app.
collection view 促进应用程序提供的数据驱动(data-driven)视图的呈现。collection view 的唯一关注点是接手你的视图并以特定的方式把它们布局到屏幕上。collection view 关注的是视图的呈现和排列,而不是关于它们的内容。想要在应用里使用collection view, 理解collection view, 层对象,以及你的自定义对象之间的交互是至关重要的。
Relevant chapters: “Collection View Basics,” “Designing Your Data Source and Delegate”
相关章节:“Collection View Basics,” “Designing Your Data Source and Delegate”
The Flow Layout Supports Grids and Other Line-Oriented Presentations
流布局支持网格和其它面向线条的表现方式
A flow layout object is a concrete layout object provided by UIKit. You typically use the flow layout object to implement grids—that is, rows and columns of items—but the flow layout supports any type of linear flow. Because it is not just for grids, you can use the flow layout to create interesting and flexible arrangements of your content both with and without subclassing. The flow layout supports items of different sizes, variable spacing of items, custom headers and footers, and custom margins without subclassing. And subclassing allows you to tweak the behavior of the flow layout class even further.
流布局(flow layout)对象 是UIKit提供的一个具体布局对象。 通常你使用它来实现网格---就是,数据项的行和列---但是流布局还支持任何类型的线性流。因为它不仅限于网格,你可以使用它来为你的内容创建各种有趣复杂的排列,既可以子类化它也可以直接使用。 流布局支持不同尺寸的数据项, 项的间距可变,可以自定义页头(header)和页脚(footer), 已经无需子类化就可以定制页边空白(margin)。 子类化能让你更进一步的调整流布局类的行为。
Relevant chapter: “Using the Flow Layout”
Gesture Recognizers Can Be Used for Cell and Layout Manipulations
手势识别能用于单元(cell)和布局操作
Like all views, you can attach gesture recognizers to a collection view to manipulate the content of that view. Because a collection view involves the collaboration of multiple views, it helps to understand some basic techniques for incorporating gesture recognizers into your collection views. You can use gesture recognizers to tweak layout attributes or to manipulate items in the collection view.
就像所有视图一样,你可以在collection view里采用手势识别来操作视图的内容。因为collection view 涉及了多个视图的协作, 在collection view 里结合手势识别能有助于理解一些基本技术。你可以在collection view里调整(tweak)层属性或操作数据项。
Relevant chapter: “Incorporating Gesture Support”
Custom Layouts Let You Go Beyond Grids
自定义布局让你超越网格布局
The basic layout object can be subclassed to implement custom layouts for your app. Designing a custom layout does not require a large amount of code in most cases. However, it helps to understand how layouts work so that you can design your layout objects to be efficient.
基本的布局对象能被子类化来实现应用程序里的自定义布局。 在大多数情况下,自定义布局不需要大量的的代码。 然而,它能帮助你理解布局是如何工作的,那样你就能设计高效的布局对象。
Relevant chapter: “Creating Custom Layouts”
Prerequisites(先决条件)
Before reading this document, you should have a solid understanding of the role views play in iOS apps. If you are new to iOS programming and not familiar with the iOS view architecture, read View Programming Guide for iOS before reading this book.
在你阅读本文章之前,你应该对iOS应用中的视图有一个坚实的理解。如果你是iOS编程的新手,不熟悉iOS视图架构,请先阅读View Programming Guide for iOS。
See Also(同时查看)
For a guided overview of collection views, see the following WWDC videos:
collection views的指导性概述,请看以下WWDC视频:
Collection views are somewhat related to table views, in that both present ordered data to the user. However, the visual presentation of table views is geared around a single-column layout, whereas collection views can support many different layouts. For more information about table views, see Table View Programming Guide for iOS.
Collection views 跟表格视图(table views)有一些关联, 两者都是给用户呈现有序数据。然而,表格视图的视觉呈现是面向单列布局,而collection views 能支持很多不同的布局。 关于表格视图的更多信息,请看Table View Programming Guide for iOS.
Collection View Programming Guide for iOS---(一)----About iOS Collection Views的更多相关文章
- Collection View Programming Guide for iOS---(七)---Custom Layouts: A Worked Example
Custom Layouts: A Worked Example Creating a custom collection view layout is simple with straightfor ...
- Collection View Programming Guide for iOS---(五)---Incorporating Gesture Support
Incorporating Gesture Support 结合手势支持 You can add greater interactivity to your collection views th ...
- Collection View Programming Guide for iOS---(六)---Creating Custom Layouts
Creating Custom Layouts 创建自定义布局 Before you start building custom layouts, consider whether doing so ...
- Collection View Programming Guide for iOS---(二)----Collection View Basics
Collection View Basics Collection View 基础 To present its content onscreen, a collection view coope ...
- Collection View Programming Guide for iOS---(三)---Designing Your Data Source and Delegate
Designing Your Data Source and Delegate 设计你的数据源和委托 Every collection view must have a data source o ...
- Collection View Programming Guide for iOS---(四)---Using the Flow Layout
Using the Flow Layout使用流布局 The UICollectionViewFlowLayout class is a concrete layout object that y ...
- View Programming Guide for iOS ---- iOS 视图编程指南(四)---Views
Views Because view objects are the main way your application interacts with the user, they have many ...
- 【IOS笔记】View Programming Guide for iOS -1
原文:View Programming Guide for iOS View and Window Architecture Views and windows present your applic ...
- View Programming Guide for iOS_读书笔记[正在更新……]
原文:View Programming Guide for iOS 1 Introduction 先熟悉一下基本概念. Window Windows do not have any visible c ...
随机推荐
- 加密算法和MD5等散列算法的区别(转)
本文转自http://www.cnblogs.com/eternalwt/archive/2013/03/21/2973807.html 感谢作者 1.在软件开发的用户注册功能中常出现MD5加密这个概 ...
- time is always a factor, time is always now!!!!
https://www.linkedin.com/pulse/time-always-now-joe-alderman ---------------------------------------- ...
- gameplay理解
Camera视角:确定显示的视场及视角. Game:显示的基类.静态单例模式.但是获取方式很奇怪. Game::getInstance得到的是__gameInstance,但是__gameInstan ...
- Android兼容性测试CTS
一.简介 为了确保Android应用能够在所有兼容Android的设备上正确运行,并且保持相似的用户体验,在每个版本发布之时,Android提供了一套兼容性测试用例集合(Compatibility ...
- eclipse中progress一直在刷新问题处理
- ScrollView白边问题
在Android开发所使用的ScrollView中..兼容比較低的版本号的时候(比方14)会出现难看的白边.这时假设使用的是xml布局文件话设置ScrollView的android:fadingEdg ...
- Linux和Windows设备驱动架构比较
毕业后一直在学操作系统, 有时候觉得什么都懂了,有时候又觉得好像什么都不懂,但总体来说自认为对操作系统实现机制的了解比周围的人还是要多一些.去年曾花了几个星期的晚上时间断断续续翻译了这篇对Linux和 ...
- WCF服务端的.NET Core支持项目Core WCF 正式启动
长期以来在wcf客户端库 https://github.com/dotnet/wcf 里反应最强烈的就是.NET Core的服务端支持 https://github.com/dotnet/wcf/is ...
- iOS 内购遇到的坑
一.内购沙盒测试账号在支付成功后,再次购买相同 ID 的物品,会提示如下内容的弹窗.您以购买过此APP内购项目,此项目将免费恢复 原因: 当使用内购购买过商品后没有把这个交易事件关,所以当我们再次去购 ...
- pom.xml和testng.xml
转自:http://www.cnblogs.com/penghong2014/p/4380199.html <project xmlns="http://maven.apache.or ...