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 ...
随机推荐
- 【hibernate/JPA】注解方式实现 复合主键【spring boot】
1>hibernate/JPA实现复合主键的思路:是将所有的主键属性封装在一个主键类中,提供给需要复合主键的实体类使用. 2>主键类的几点要求: . 使用复合主键的实体类必须实现Seria ...
- Go -- 中结构体与字节数组能相互转化
编码时如下,假设默认你的结构体为data func Encode(data interface{}) ([]byte, error) { buf := bytes.NewBuffer(nil) enc ...
- grafana结合influxdb、open-falcon出图配置
1.https://www.jianshu.com/p/fadcf4d92b0e 2.https://www.jianshu.com/p/21ce6ee143f3 3.http://www.super ...
- 大话大前端时代(一) —— Vue 与 iOS 的组件化
序 今年大前端的概念一而再再而三的被提及,那么大前端时代究竟是什么呢?大前端这个词最早是因为在阿里内部有很多前端开发人员既写前端又写 Java 的 Velocity 模板而得来,不过现在大前端的范围已 ...
- BUPT复试专题—最近公共祖先(2014软院)
题目描述 给出一棵有N个节点的有根树TREE(根的编号为1),对于每组查询,请输出树上节点u和v的最近公共祖先. 最近公共祖先:对于有向树TREE的两个结点u,v.最近公共祖先LCA(TREE u,v ...
- 使用maven创建项目和cannot change version web module 3.0
近期下载了最新的Eclipse mars.2, 这个eclipse自带了maven插件,于是就用maven尝试创建一个java web项目. 第一步,例如以下图所看到的选择 Maven Project ...
- PHP读取excel(6)
有时候我们只需要读取某些指定sheet,具体代码如下: <?php header("Content-Type:text/html;charset=utf-8"); //引入读 ...
- 组件接口(API)设计指南[2]-类接口(class interface)
*返回文件夹阅读其它章节: http://blog.csdn.net/cuibo1123/article/details/39894477 类接口(class interface) 你能够參考MGTi ...
- 在线API
JExcelApi http://jexcelapi.sourceforge.net/resources/javadocs/index.html Poi http://poi.apache.org/a ...
- Django 之 form表单
Django中的Form表单 1.背景 平时我们在书写form表单时,经常都是手动的去写一些input标签,让用户输入一些功能,进行一些校验的判断,等等.Django中的form表单就能够帮我们去实现 ...