Customised collectionView
来源:互联网 发布:nginx 压力测试 编辑:程序博客网 时间:2024/05/15 08:55
1. Construction
var flowLayOut =UICollectionViewFlowLayout()
var collectionView: UICollectionView?//must be optional
2. Setting
Frequently-used properties for flowLayOut:
itemSize, minimumInteritemSpacing, minimumLineSpacing, scrollDirection
collectionView = UICollectionView(frame: CGRect(...), collectionViewLayout: flowLayOut)
Frequently-used methods for collectionView:
reloadData()
deselectItemAtIndexPath()
3. Delegate
UICollectionViewDataSource,
UICollectionViewDelegateFlowLayout
funcnumberOfSectionsInCollectionView(collectionView:UICollectionView) -> Int {}
func collectionView(collectionView:UICollectionView, numberOfItemsInSection section: Int) ->Int {}
func collectionView(collectionView:UICollectionView, layout collectionViewLayout:UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) ->CGSize {}
func collectionView(collectionView:UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) ->UICollectionViewCell {
collectionView.registerClass(myCollectionViewCell.self, forCellWithReuseIdentifier: "myCell")
var cell = collectionView.dequeueReusableCellWithReuseIdentifier("myCell", forIndexPath: indexPath)as? myCollectionViewCell
}
func collectionView(collectionView:UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {}
4. Nesting
To nest a collectionView inside a collectionViewCell, do the exact same thing as if the collectionViewCell class is a VC. The only tricky part ispassing values between the "big" collectionView and the "small" collectionView. I use customised delegate (refer to another blog about customised delegate).
- Customised collectionView
- CollectionView
- collectionView
- collectionView
- collectionView
- CollectionView
- CollectionView
- collectionView
- collectionView
- CollectionView
- collectionView
- collectionview
- Customised delegate 自定义代理
- Customised UINavigationBar backg…
- collectionView学习
- iOS CollectionView
- iOS---collectionView
- collectionView 小结
- Android中IntentService与Service的区别
- hiho拓扑排序专题 ——第四十八、四十七周
- Shell编程基础(3)
- android亮屏、黑屏、解锁事件的系统广播接收
- 挺不错的移动端调试工具----debuggap
- Customised collectionView
- 字典树
- Haskell之Yesod开发–简单网站开发(四)
- JAVA 调用MQ
- [image processing]matlab
- iOS开发应用程序图标大小汇总
- sql两个表结果计算后合并数据
- 由于undo tablespace没有空间不够导致的问题
- Android_多媒体详解