class UICollectionView : UIScrollView
//初始化,位置,风格 
init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) //布局风格

var collectionViewLayout: UICollectionViewLayout

//代理

unowned(unsafe) var delegate: UICollectionViewDelegate?

//数据源

unowned(unsafe) var dataSource: UICollectionViewDataSource?

//背景视图

var backgroundView: UIView?

//注册cell
func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)

func registerClass(viewClass: AnyClass?, forSupplementaryViewOfKind elementKind: String, withReuseIdentifier identifier: String)

func registerNib(nib: UINib?, forSupplementaryViewOfKind kind: String, withReuseIdentifier identifier: String)

func dequeueReusableCellWithReuseIdentifier(identifier: String, forIndexPath indexPath: NSIndexPath!) -> AnyObject

func dequeueReusableSupplementaryViewOfKind(elementKind: String, withReuseIdentifier identifier: String, forIndexPath indexPath: NSIndexPath!) -> AnyObject

 var allowsSelection: Bool // default is YES
var allowsMultipleSelection: Bool // default is NO
//返回被选中的items

func indexPathsForSelectedItems() -> [AnyObject] // returns nil or an array of selected index paths

//选中弄个indexpath, 是否有动画,

func selectItemAtIndexPath(indexPath: NSIndexPath?, animated: Bool, scrollPosition: UICollectionViewScrollPosition)

//取消选中

func deselectItemAtIndexPath(indexPath: NSIndexPath?, animated: Bool)

//刷新数据

func reloadData()

func setCollectionViewLayout(layout: UICollectionViewLayout, animated: Bool)


func setCollectionViewLayout(layout: UICollectionViewLayout, animated: Bool)

@availability(iOS, introduced=7.0)

func setCollectionViewLayout(layout: UICollectionViewLayout, animated: Bool, completion: ((Bool) -> Void)!)

@availability(iOS, introduced=7.0)

func startInteractiveTransitionToCollectionViewLayout(layout: UICollectionViewLayout, completion: UICollectionViewLayoutInteractiveTransitionCompletion?) -> UICollectionViewTransitionLayout

@availability(iOS, introduced=7.0)

func finishInteractiveTransition()

@availability(iOS, introduced=7.0)

func cancelInteractiveTransition()

//有几个

func numberOfSections() -> Int

//每个有多少行

func numberOfItemsInSection(section: Int) -> Int

func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes?

func layoutAttributesForSupplementaryElementOfKind(kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes?

func indexPathForItemAtPoint(point: CGPoint) -> NSIndexPath?

func indexPathForCell(cell: UICollectionViewCell) -> NSIndexPath?

func cellForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewCell?

func visibleCells() -> [AnyObject]

func indexPathsForVisibleItems() -> [AnyObject]

//滚动到indespath位置

func scrollToItemAtIndexPath(indexPath: NSIndexPath, atScrollPosition scrollPosition: UICollectionViewScrollPosition, animated: Bool)


//插入

func insertSections(sections: NSIndexSet)

//删除
  func deleteSections(sections: NSIndexSet)
//重载弄个

func reloadSections(sections: NSIndexSet)

//移动

func moveSection(section: Int, toSection newSection: Int)

func performBatchUpdates(updates: (() -> Void)?, completion: ((Bool) -> Void)?)

 
extension NSIndexPath {

    init!(forItem item: Int, inSection section: Int) -> NSIndexPath

    @availability(iOS, introduced=6.0)
var item: Int { get }
}

UICollectionView的常用方法的更多相关文章

  1. iOS开发- UICollectionView详解+实例

    本章通过先总体介绍UICollectionView及其常用方法,再结合一个实例,了解如何使用UICollectionView. UICollectionView 和 UICollectionViewC ...

  2. iOS开发——UI篇OC篇&UICollectionView详解+实例

    UICollectionView详解+实例 实现步骤: 一.新建两个类 1.继承自UIScrollView的子类,比如HMWaterflowView * 瀑布流显示控件,用来显示所有的瀑布流数据 2. ...

  3. [转] iOS开发- UICollectionView详解+实例

    本章通过先总体介绍UICollectionView及其常用方法,再结合一个实例,了解如何使用UICollectionView. UICollectionView 和 UICollectionViewC ...

  4. iOS-UICollectionView

    1--------------------------------------------------------------------------------------------------- ...

  5. iOS-UICollectionView的简单使用(原创)

    前言 UICollectionView是一种新的数据展示方式,简单来说可以把他理解成多列的UITableView(请一定注意这是UICollectionView的最最简单的形式).如果你用过iBook ...

  6. iOS UICollectionView简单使用

    UICollectionView 和 UICollectionViewController 类是iOS6 新引进的API,用于展示集合视图,布局更加灵活,可实现多列布局,用法类似于UITableVie ...

  7. iOS流布局UICollectionView使用FlowLayout进行更灵活布局

    一.引言 前面的博客介绍了UICollectionView的相关方法和其协议中的方法,但对布局的管理类UICollectionViewFlowLayout没有着重探讨,这篇博客介绍关于布局的相关设置和 ...

  8. iOS UI-集合视图(UICollectionView)

    BowenCollectionViewCell.xib #import <UIKit/UIKit.h> @interface BowenCollectionViewCell : UICol ...

  9. UICollectionView的简单认识和简单实用

    摘要 UICollectionView是比UITableView更加复杂的UI控件,通过它可以实现许多复杂的流布局.但对我们来说,系统提供的接口十分简单易用,并且有十分强的制定性. iOS流布局UIC ...

随机推荐

  1. logging模块--日志文件

    初级的使用配置模式类似与print 默认打印waring等级及以上--通过更改等级来测试代码 logging.debug("debug no china") #调试模式 loggi ...

  2. 利用URLConnection http协议实现webservice接口功能(附HttpUtil.java)

    URL的openConnection()方法将返回一个URLConnection对象,该对象表示应用程序和 URL 之间的通信链接.程序可以通过URLConnection实例向该URL发送请求.读取U ...

  3. sonar——"entrySet()" should be iterated when both the key and value are needed

    When only the keys from a map are needed in a loop, iterating the keySet makes sense. But when both ...

  4. QPainter

    1.QPainter使用save()函数来保存QPainter的状态,并且用restore()函数来使他们回退. void MainWindow::paintEvent(QPaintEvent *ev ...

  5. C/C++中如何在main()函数之前执行一条语句?

    在C语言中,如果使用GCC的话,可以通过attribute关键字声明constructor和destructor(C语言中如何在main函数开始前执行函数) #include <stdio.h& ...

  6. Laravel 5.2--git冲突error: Your local changes to the following files would be overwritten by merge:

    今天在服务器上git pull是出现以下错误: error: Your local changes to the following files would be overwritten by mer ...

  7. [C][代码实例]交换指向常量的二级指针的位置

    #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> ...

  8. python创建tcp服务端和客户端

    1.tcp服务端server from socket import * from time import ctime HOST = '' PORT = 9999 BUFSIZ = 1024 ADDR ...

  9. 将list集合转json

    public static class DataHelper { /// /// js 序列化器 /// static JavaScriptSerializer jss = new JavaScrip ...

  10. 2)django-请求生命周期

    1)下图是django请求生命周期 2)详细例子