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 ...
随机推荐
- Apollo 启动脚本解析
Apollo 启动脚本解析 sudo service docker start -- 是在ubuntu14.04中打开 在dev_start.sh脚本中会调用restart_map_volume.sh ...
- js垃圾回收(转
和C#.Java一样JavaScript有自动垃圾回收机制,也就是说执行环境会负责管理代码执行过程中使用的内存,在开发过程中就无需考虑内存分配及无用内存的回收问题了.JavaScript垃圾回收的机制 ...
- Golang -- range小坑铭记
废话少叙,先上一段代码,猜猜预期的效果. package main import ( "fmt" ) type student struct { Name string Age i ...
- chan array初始化
package main import "fmt" func run() { chann[0] <- 1 } var chann = make([]chan int, 2) ...
- mysql 定时备份bat脚本 ,方便小型服务简单快速备份mysql
mysql定时备份bat脚本 echo 数据库为用户名为root 密码为root 数据库名为kdykt echo mysqldump 命令如果没有配置环境变量要在bin目录下执行 set " ...
- Vue - Router 路由
路由的注册 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...
- 前端 ---JS中的面向对象
JS中的面向对象 创建对象的几种常用方式 1.使用Object或对象字面量创建对象 2.工厂模式创建对象 3.构造函数模式创建对象 4.原型模式创建对象 1.使用Object或对象字面量创建对象 ...
- 前端 -----02 body标签中相关标签
今日内容: 字体标签: h1~h6.<font>.<u>.<b>.<strong><em>.<sup>.<sub> ...
- Spring通过SchedulerFactoryBean实现调度任务的配置(定时器)
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- python 安装mysql报错
原 安装Python mysqlclient出现“OSError: mysql_config not found”错误 2016年06月01日 12:15:11 wangtaoking1 阅读数:11 ...