IOS Collection View Guide 1: Introduction

Source: Internet
Author: User

About iOS Collection view (about iOS collection views)

A collection view is a by-present an ordered set of data items using a flexible and changeable layout. The most common with collection views is to present items in a grid-like arrangement, but collection views in IOS are C Apable of more than just rows and columns. With collection views, the precise layout of visual elements was definable through subclassing and can be changed dynamical Ly, so can implement grids, stacks, circular layouts, dynamically changing layouts, or any of the 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 Da Ta. In most cases, your app was 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 the conjunction with a layout object, which specifies the placement and visual attributes for your views And that can is 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 Ieces together to achieve the final appearance.


A collection view is a way to show ordered items of data through a flexible layout. The collection view typically presents the data as a mesh, but the collection view in iOS is much more than just rows and columns. The collection view can be sub-typed to achieve precise positioning and dynamic change of elements, so you can implement Web sites, stacks, loops, and any layout you can think of.
The Collection view guarantees a strict separation between the interface and the data. In most cases, your app only has to be responsible for managing the data. The collection view will then complete all of your interface layout tasks. The collection view and the layout object do this together, and the layout object specifies the location of your view and the city Board properties, and you can implement the actual needs of your application by subclasses of the layout object. So, the data information you provide, the location information provided by the layout object, is integrated by the collection view to achieve the final impression.
At a Glance (overview)

The standard IOS collection view classes provide all of the behavior your need to implement simple grids. You can also extend the standard classes-to-support custom layouts and specific interactions with those layouts.

The standard iOS collection view class provides you with all the behavior of implementing a simple grid. Of course you can also extend the standard classes to support custom layouts and those that interact with each other.

A Collection View manages the Visual Presentation of Data-driven views

Relevant chapters: Collection View Basics, designing Your Data Source and Delegate

Collection View Control visual presentation (data-drive-view)

The collection view facilitates the presentation of data-driven views provided by the application. The collection view only cares about getting your views and laying them out in a specific way. The collection view only cares about how to show and schedule your views and not relate to the content in the view. Understanding the interrelationships between views, data sources, layout objects, and your custom objects are key to the collection view that is used within your app, especially smart and efficient methods.


Related chapters: Collection view basics, designing your data sources and proxies


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 are, rows and columns of items-but the flow layout support s any type of linear flow. Because It isn't just for grids, you can use the flow layout to create interesting and flexible arrangements of your cont Ent both with and without subclassing. The flow layout supports items of different sizes, variable spacing of items, custom headers and footers, and custom Margi NS without subclassing. And subclassing allows you to tweak the behavior of the flow layout class even further.


Supports flow layouts for grids and other linear displays

The flow layout object is a specific layout object provided by the Uikit framework. Typically, you can use a flow layout object to implement a mesh (composed of row and column elements), but the flow layout object supports any type of streamlined layout. Because flow layouts not only support network layouts, you can create smooth and interesting content configurations using a mobile layout, regardless of whether you use subclasses. In the absence of subclasses the flow layout can be supported, different size elements, the distance between them, custom header footer, and custom boundaries. By subclasses you can adjust the flow layout class more powerful.

Relevant chapter: Using the Flow Layout

related chapters: using flow layouts
Gesture recognizers Can is used for Cell and Layout manipulations

Like any view, you can attach gesture recognizers to a collection view to manipulate the content of the. Because A collection view involves the collaboration of multiple views, it helps to understand some basic techniques for I Ncorporating gesture recognizers into your collection views. You can use the gesture recognizers to tweak layout attributes or to manipulate items in a collection view.

gesture actions can be used in cell and layout operations
just like all views, you can add gesture recognition to a collection view to manipulate many of the content views. Because the collection view involves multi-view collaboration, this helps you understand the basic techniques for multiple view collaboration in a collection view. You can use gesture recognition to adjust the layout properties in the collection view and the elements in the Operation view.


Relevant chapter: incorporating Gesture support

related chapters: combining gesture support

Custom Layouts Let go Beyond Grids (customizable layout lets you go beyond the grid layout)

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 Layou TS work, the better-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.

Relevant chapters: Creating Custom Layouts, custom layouts:a worked Example

you can subclass the underlying layout object to enable your app to customize the layout. Although a custom layout usually doesn't require a lot of code, the more you understand how the layout works, the more efficient layout objects you design. In the last chapter of the guide, we focus on a complete example of a custom layout project.


Related chapters: Creating custom layouts, customizing layouts: one instance.


Prerequisites (Prerequisites)

Before reading this document, you should has a solid understanding of the role views play in IOS apps. If you is new to iOS programming and is familiar with the iOS view architecture, read View Programming Guide for iOS before reading this book.

Before reading this document, you should have a deep understanding of what role a view should play in iOS. If you are a novice iOS programmer and do not understand the structure of the view in iOS, read the iOS View Programming Guide before reading this book.


Seeing Also (see also)

Collection views is somewhat related to table views, in this both present ordered data to the user. The implementation of a table view is similar to that's a standard collection view (one which uses the provided flow Layo UT) in it use of index paths, cells, and view recycling. However, the visual presentation of table views are geared around a single-column layout, whereas collection views can supp ORT many different layouts. For more information on table views, seeTable View ProgrammingGuide for IOS.

There are some relationships between the collection view and the presentation diagram, and they are all displaying the ordered user data. Implementing a presentation diagram and implementing a standard collection view (provided with a flow layout) is very similar to Indexpaths,cell, and view reuse. Nonetheless, TableView is presented in a single-column layout, and the collection view supports multiple layouts. For more information, see the iOS Table View Programming Guide

This article original, reproduced please indicate the source:http://blog.csdn.net/zhenggaoxing/article/details/44082725









IOS Collection View Guide 1: Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.