UICollectionView的常用方法
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的常用方法的更多相关文章
- iOS开发- UICollectionView详解+实例
本章通过先总体介绍UICollectionView及其常用方法,再结合一个实例,了解如何使用UICollectionView. UICollectionView 和 UICollectionViewC ...
- iOS开发——UI篇OC篇&UICollectionView详解+实例
UICollectionView详解+实例 实现步骤: 一.新建两个类 1.继承自UIScrollView的子类,比如HMWaterflowView * 瀑布流显示控件,用来显示所有的瀑布流数据 2. ...
- [转] iOS开发- UICollectionView详解+实例
本章通过先总体介绍UICollectionView及其常用方法,再结合一个实例,了解如何使用UICollectionView. UICollectionView 和 UICollectionViewC ...
- iOS-UICollectionView
1--------------------------------------------------------------------------------------------------- ...
- iOS-UICollectionView的简单使用(原创)
前言 UICollectionView是一种新的数据展示方式,简单来说可以把他理解成多列的UITableView(请一定注意这是UICollectionView的最最简单的形式).如果你用过iBook ...
- iOS UICollectionView简单使用
UICollectionView 和 UICollectionViewController 类是iOS6 新引进的API,用于展示集合视图,布局更加灵活,可实现多列布局,用法类似于UITableVie ...
- iOS流布局UICollectionView使用FlowLayout进行更灵活布局
一.引言 前面的博客介绍了UICollectionView的相关方法和其协议中的方法,但对布局的管理类UICollectionViewFlowLayout没有着重探讨,这篇博客介绍关于布局的相关设置和 ...
- iOS UI-集合视图(UICollectionView)
BowenCollectionViewCell.xib #import <UIKit/UIKit.h> @interface BowenCollectionViewCell : UICol ...
- UICollectionView的简单认识和简单实用
摘要 UICollectionView是比UITableView更加复杂的UI控件,通过它可以实现许多复杂的流布局.但对我们来说,系统提供的接口十分简单易用,并且有十分强的制定性. iOS流布局UIC ...
随机推荐
- EntityFramework之事务
一.EF事务 引用程序集 using System.Transactions; 用法 var writer = new System.IO.StringWriter(); try { using (v ...
- win32编程中消息循环和WndProc()窗口过程函数
原文地址:https://blog.csdn.net/zxxSsdsd/article/details/45504383 在win32程序的消息循环函数中 while (GetMessage (&a ...
- 【HAOI2008】硬币购物
既然没人写扩欧,那我就来一发吧. 扩欧也还好,就是跑的有点慢,然后写的时候还有点烦,不过还是卡过去了. 考场上看到这道题又蒙了...怎么回事第一题又要爆零了? 然后我打了个暴力测了一下极限数据根本过不 ...
- python操作三大主流数据库(4)python操作mysql④python服务端flask和前端bootstrap框架结合实现新闻展示
python操作mysql④python服务端flask和前端bootstrap框架结合实现新闻展示 参考文档http://flask.pocoo.org/docs/0.11/http://flask ...
- signal & slot
The Qt signals/slots and property system are based on the ability to introspect the objects at runti ...
- 如何将本地项目上传到Github
看了这篇文章觉得写的很详细很适合初学者 提供给大家参考下. http://blog.csdn.net/zamamiro/article/details/70172900 注意如果第二次git pus ...
- Python-数据类型 主键auto_increment
MySQL数据操作: DML========================================================在MySQL管理软件中,可以通过SQL语句中的DML语言来实 ...
- 玩转 lua in Redis
一.引言 Redis学了一段时间了,基本的东西都没问题了.从今天开始讲写一些redis和lua脚本的相关的东西,lua这个脚本是一个好东西,可以运行在任何平台上,也可以嵌入到大多数语言当中,来扩展其功 ...
- JAVA框架之Hibernate框架的学习步骤
首先介绍一下Java三大框架的关系 以CRM项目即客户关系管理项目示例 hibernate框架的学习路线: 1.学习框架入门,自己搭建框架,完成增删改查的操作 2.学习一级缓存,事物管理和基本查询 3 ...
- 不想用ssh框架
学过三遍多的样子,没有感悟到特别多的好处. 现在工作都用,想找一个不用这个的工作就不好找.c的话,觉得没有Java面向对象提炼得好. 不是很明白怎么都用,知道自己不想用.里边太多复杂和要背下来的东西, ...