星空网 > 软件开发 > 操作系统

UICollectionViewCell定制Button

UICollectionViewCell定制Button

 

效果

UICollectionViewCell定制Buttonimages/loading.gif' data-original="http://images2015.cnblogs.com/blog/976232/201608/976232-20160824114010651-1452874953.gif" />

 

特点

1.能够动态设置每行显示的按钮的个数,以及控件的摆放格式

2.实现单选或者多选的功能,实现点击事件

3.自定制按钮的显示样式

 

用法

1.下载源码后,将文件中的GridCollectionView.h/.m文件,  CustomCollectionViewCell.h/.m文件,  TypeCellClass.h/.m文件导入工程中.

2.注意:你所创建的cell要继承CustomCollectionViewCell.然后你的cell上实现他所继承的类的几个方法,并创建你想要的界面.

3.在控制器中导入相关头文件,具体用法,参考源码.

 

源码

github:https://github.com/makingitbest/Button-CollectionView

 

细节

1.在UICollectionViewCell的基础上,给了几个方法,方便以后你在上面定制将要显示的控件,本demo是加载的button

UICollectionViewCell定制Button

 

2.给这个类,是为了在外部传入注册的cell类型.标识符UICollectionViewCell定制Button

 

3. 对UICollectionView的封装

UICollectionViewCell定制Button

UICollectionViewCell定制Button

以上都是底层的封装.

4.具体的操作如下:

UICollectionViewCell定制Button

 

5.它有一个协议,处理点击事件的

UICollectionViewCell定制Button

 

6.单选和多选的状态设定在各自cell的内部处理

UICollectionViewCell定制Button

 




原标题:UICollectionViewCell定制Button

关键词:ie

ie
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流