IOS 集合视图指南1:介绍

About iOS Collection Views(关于IOS集合视图)

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 views keep a strict separation between the data being presented and the visual elements used to present that data. In most cases, 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, which specifies the placement and visual attributes for your views and that can be subclassed to fit your app’s exact needs. 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.


集合视图是一种通过灵活多变的布局展现有序数据项的方法。通常集合视图把数据展示成网状,但是IOS中的集合视图能胜任的远远不止行和列。集合视图可以通过子类化来实现元素的精确定位和动态更改,于是你可以实现网站,栈形,循环以及任何你能想到的各种布局。

集合视图保证了界面和数据的严格分离。在大部分情况下,你的应用只需要负责管理数据。然后,集合视图会完成你所有的界面布局任务。集合视图和布局对象一起完成这些工作,布局对象指定了你的视图的位置和市局属性,你可以通过子类化布局对象来实现你的应用的切实需求。于是呢,你提供的数据信息,布局对象提供的位置信息,由集合视图综合起来实现最终的展示效果。

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集合视图类提供了你实现一个简单网格的所有行为。当然你也可以拓展标准类以支持自定义布局和那些相互作用的布局。

A Collection View Manages the Visual Presentation of Data-Driven Views

A collection view facilitates the presentation of data-driven views provided by your app. The collection view’s only concern is 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, its data source, the layout object, and your custom objects is crucial for using collection views in your app, particularly in smart and efficient ways.

集合视图控制视觉展现(数据—驱动—视图)

集合视图便于展示由应用程序提供的数据驱动的视图。集合视图只关心获取你的视图并且把他们按照特定的方式布局。集合视图只关心如何展示和安排你的视图并不关系视图中的内容。理解视图之间的相互关系,数据源,布局对象,和你的自定义对象是在你的应用里面使用的集合视图的关键,特别是智能和有效方法。


相关章节:集合视图基础,设计你的数据源和代理


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.


支持网格和其他线性展示的流动布局

流动布局对象是UIKit框架提供的一个具体的布局对象。通常情况下,你可以使用流动布局对象来实现网格(由行列元素组成),但是流动布局对象支持任何类型的流线型布局。因为流动布局不仅仅支持网络布局,不管你使用不使用子类化,你都可以使用流动布局创建流畅有趣的内容排布。在没有子类化的情况下流动布局可以支持,不同尺寸的元素,他们之间变化的距离,自定义页眉页脚,和自定义的边界。通过子类化你可以把流动布局类调整的更加强大。

Relevant chapter: Using the Flow Layout

相关章节:使用流动布局

Gesture Recognizers Can Be Used for Cell and Layout Manipulations

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 a collection view.

手势操作可以使用在单元格和布局操作中
就像所有视图一样 ,你可以给集合视图添加手势识别来操控诸多内容视图。因为集合视图牵涉了多视图的协作,这会帮助你理解集合视图之中多个视图协作的基本技术。你可以使用手势识别来调整集合视图中的布局属性和操作视图中的元素。


Relevant chapter: Incorporating Gesture Support

相关章节:结合手势支持

Custom Layouts Let You Go Beyond Grids(自定义布局让你超越网格布局)

You can subclass the basic layout object to implement custom layouts for your app. Even though designing a custom layout does not typically require a large amount of code, the more you understand how layouts work, the better you can design your layout objects to be efficient. The guide’s final chapter focuses on an example project with a full implementation of a custom layout.

你可以子类化基础布局对象来实现让你的应用自定义布局。尽管通常情况下自定义布局并不需要大量代码,但是你越理解布局是怎样工作的,你设计的布局对象就越有效。在指南的最后一章节,我们集中来看一个完整的自定义布局的项目范例。


相关章节:创建自定义布局,自定义布局:一个实例。


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中视图的结构,请在阅读本书之前读《IOS 视图编程指南》。


See Also(另见)

Collection views are somewhat related to table views, in that both present ordered data to the user. The implementation of a table view is similar to that of a standard collection view (one which uses the provided flow layout) in its use of index paths, cells, and view recycling. 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, seeTable View Programming Guide for iOS.

集合视图和表示图有些关系,他们都是展示有序的用户数据。实现一个表示图和实现一个标准的集合视图(使用流动布局提供的)在indexPaths,cell,和视图复用上非常类似。尽管如此,tableView的展现形式是单列布局,而集合视图支持多种布局。更多信息参见《IOS表视图编程指南》

本文原创,转载请注明出处: http://blog.csdn.net/zhenggaoxing/article/details/44082725









  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
机器学习是一种人工智能(AI)的子领域,致力于研究如何利用数据和算法让计算机系统具备学习能力,从而能够自动地完成特定任务或者改进自身性能。机器学习的核心思想是让计算机系统通过学习数据中的模式和规律来实现目标,而不需要显式地编程。 机器学习应用非常广泛,包括但不限于以下领域: 图像识别和计算机视觉: 机器学习在图像识别、目标检测、人脸识别、图像分割等方面有着广泛的应用。例如,通过深度学习技术,可以训练神经网络来识别图像中的对象、人脸或者场景,用于智能监控、自动驾驶、医学影像分析等领域。 自然语言处理: 机器学习在自然语言处理领域有着重要的应用,包括文本分类、情感分析、机器翻译、语音识别等。例如,通过深度学习模型,可以训练神经网络来理解和生成自然语言,用于智能客服、智能助手、机器翻译等场景。 推荐系统: 推荐系统利用机器学习算法分析用户的行为和偏好,为用户推荐个性化的产品或服务。例如,电商网站可以利用机器学习算法分析用户的购买历史和浏览行为,向用户推荐感兴趣的商品。 预测和预测分析: 机器学习可以用于预测未来事件的发生概率或者趋势。例如,金融领域可以利用机器学习算法进行股票价格预测、信用评分、欺诈检测等。 医疗诊断和生物信息学: 机器学习在医疗诊断、药物研发、基因组学等领域有着重要的应用。例如,可以利用机器学习算法分析医学影像数据进行疾病诊断,或者利用机器学习算法分析基因数据进行疾病风险预测。 智能交通和物联网: 机器学习可以应用于智能交通系统、智能城市管理和物联网等领域。例如,可以利用机器学习算法分析交通数据优化交通流量,或者利用机器学习算法分析传感器数据监测设备状态。 以上仅是机器学习应用的一部分,随着机器学习技术的不断发展和应用场景的不断拓展,机器学习在各个领域都有着重要的应用价值,并且正在改变我们的生活和工作方式。
机器学习是一种人工智能(AI)的子领域,致力于研究如何利用数据和算法让计算机系统具备学习能力,从而能够自动地完成特定任务或者改进自身性能。机器学习的核心思想是让计算机系统通过学习数据中的模式和规律来实现目标,而不需要显式地编程。 机器学习应用非常广泛,包括但不限于以下领域: 图像识别和计算机视觉: 机器学习在图像识别、目标检测、人脸识别、图像分割等方面有着广泛的应用。例如,通过深度学习技术,可以训练神经网络来识别图像中的对象、人脸或者场景,用于智能监控、自动驾驶、医学影像分析等领域。 自然语言处理: 机器学习在自然语言处理领域有着重要的应用,包括文本分类、情感分析、机器翻译、语音识别等。例如,通过深度学习模型,可以训练神经网络来理解和生成自然语言,用于智能客服、智能助手、机器翻译等场景。 推荐系统: 推荐系统利用机器学习算法分析用户的行为和偏好,为用户推荐个性化的产品或服务。例如,电商网站可以利用机器学习算法分析用户的购买历史和浏览行为,向用户推荐感兴趣的商品。 预测和预测分析: 机器学习可以用于预测未来事件的发生概率或者趋势。例如,金融领域可以利用机器学习算法进行股票价格预测、信用评分、欺诈检测等。 医疗诊断和生物信息学: 机器学习在医疗诊断、药物研发、基因组学等领域有着重要的应用。例如,可以利用机器学习算法分析医学影像数据进行疾病诊断,或者利用机器学习算法分析基因数据进行疾病风险预测。 智能交通和物联网: 机器学习可以应用于智能交通系统、智能城市管理和物联网等领域。例如,可以利用机器学习算法分析交通数据优化交通流量,或者利用机器学习算法分析传感器数据监测设备状态。 以上仅是机器学习应用的一部分,随着机器学习技术的不断发展和应用场景的不断拓展,机器学习在各个领域都有着重要的应用价值,并且正在改变我们的生活和工作方式。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值