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 ...
随机推荐
- 运行vue遇到的坑(续更
从Github上clone了别人的vue项目在自己电脑上运行时,出现很多错误,暂且列举下: 1.chromedriver@2.35.0安装不了的问题 正常项目clone下来,在cmd里运行: $ np ...
- Spring+Hibernate 多数据源不同事务创建
环境:Spring 3.0 ,Hibernate 3.5 ,同类型数据库(DB2) 编前语:此片仅粗略的描述使用Spring和Hibernate采用注入方式管理多数据源在不同事务的情况下使用的方法. ...
- DHTMLX Tree中文开发指导
专业版1.6下载地址(CSDN) http://download.csdn.net/source/1388340 版本号:dhtmlxTree v.1.6 Professional edition b ...
- 前端----css的继承性和层叠性
css有两大特性; 继承性和层叠性 继承性 继承:给父级设置一些属性,子级继承了父级的该属性, 这就是我们的css中的继承, 需要注意的是 有一些属性是可以继承下来的: color , font ...
- 前端 ------ 03 body标签中的相关标签
列表标签 <ul>.<ol>.<dl> 表格标签 <table> 表单标签 <form> 一.列表标签 列表标签分为三种. 1.无序列表&l ...
- 【原创】大数据基础之Airflow(2)生产环境部署airflow研究
一 官方 airflow官方分布式部署结构图 airflow进程 webserver scheduler flower(非必须) worker airflow缺点 scheduler单点 通过在sch ...
- [C]关于extern与struct
问题 我曾经很困惑,就是在两个编译单元当中,如何把一个单元中声明的struct结构引入到另外一个单元中来,折腾了很久,后来发现这位大神的留言 不是这么用的…… 类型的定义和类型变量的定义不同,类型定义 ...
- 学习promise
总概括 promise是js异步编程的一种解决方案 我对promise的认识(通俗):给一个承诺promise,如果未来发生的事情(异步操作)是符合满足相应条件,则接受resolve,否则失败reje ...
- Confluence 6 邮件队列
需要发送的电子邮件将会在邮件队列中进行等待,Confluence 的邮件队列每分钟刷新一次.Confluence 的管理员也可以手动的刷新邮件队列中等待发送的消息. 如果在发送的时候出现了错误,那么出 ...
- LeetCode(93): 复原IP地址
Medium! 题目描述: 给定一个只包含数字的字符串,复原它并返回所有可能的 IP 地址格式. 示例: 输入: "25525511135" 输出: ["255.255. ...