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 ...
随机推荐
- CDHtmlDialog探索----Javascript与窗体交互
CDHtmlDialog提供了C++与网页的双向交互,通此一系统简单的宏调用可以把网页中各元素的事件直接映射到C++程序中,而在网页中调用C++功能代码就显的不那么直观了.归根结底交互的基理就是实现相 ...
- <杂记>Android Studio 3.0-3.1 汉化包 (转载)
JetBrains 系列软件汉化包 关键字: Android Studio 3.0-3.1 汉化包 CLion 2018.1 汉化包 GoLand 2017.3.2-2018.1 汉化包 Intell ...
- <TCP/IP>记一次关于IP地址和MAC物理地址的思考
是的,从3月6日第一次上计算机网络课起,我还是今天第一次对这本书里讲的知识点有了自己的疑问..之前看书就是 嗯嗯这好像很有道理,嗯嗯也许再多看几章就知道它在讲什么了.. 不过今天已经自学到了网络层了, ...
- UpdatePanel1里面使用FileUpload控件
最近做项目过程中,遇到了UpdatePanel1里面放了一个FileUpload控件,结果从后台就获取不到上传的文件了,找了好久才找到原因.原因: 加了红色部分后立马获取到了.
- MD5算法工具类
抽时间写了一个算法工具类,目前支持的算法有SHA1,SHA256,SHA384,SHA512,MD5,同时支持获取文件的MD5值. 使用方法如下: 获取字符串的MD5值 String str= Alg ...
- JSP的内置对象及方法
request表示HttpServletRequest 对象.它包含了有关浏览器请求的信息,并且提供了几个用于获取cookie,header, 和session 数据的有用的方法.response 表 ...
- XmlDocument.Load(url) 本地和http远程
XmlDocument.Load(url) 的使用 远程: string path = @"http://localhost:8080/Source/XMLConfig.xml"; ...
- 彻底完全卸载 SQL Server 2005 的图文教程
彻底完全卸载 SQL Server 2005 的图文教程 SQL SERVER 2005不象SERVER 2000所有组件都汇总在一起,所以卸载时特别麻烦,如果不按正常的方法卸载,重新安装是不可能安装 ...
- Confluence 6 新安装配置数据库字符集编码
Confluence 和你的数据库必须配置使用相同的字符集. Confluence 使用 UTF-8 字符集编码,所以你的数据库也必须配置为使用 UTF-8 (或者与 UTF-8 相同的编码,例如在 ...
- 基于DBUtils实现数据库连接池
小知识: 1.子类继承父类的三种方式 class Dog(Animal): #子类 派生类 def __init__(self,name,breed, life_value,aggr): # Anim ...