CollectionView中的一个cell中加载xib中的CollectionView 不显示cell
来源:互联网 发布:vscode css3前缀 编辑:程序博客网 时间:2024/05/14 12:40
在第一个CollectionView 的 dataSource 委托中新建一个CollectionView
var count =0
var cellsViewController:cellsCollectionViewController?
/*********************************** DataSource ****************************************/
func collectionView(collectionView:UICollectionView, cellForItemAtIndexPath indexPath:NSIndexPath) -> UICollectionViewCell {
let identify ="cell"
let cell =self.collectionView.dequeueReusableCellWithReuseIdentifier(
identify, forIndexPath: indexPath) as! UICollectionViewCell
let i =count % 3
ifcount == 0{
//---------------------------------------看这里------------------------------------------------------------
// var cellsViewController = cellsCollectionViewController()
self.cellsViewController =cellsCollectionViewController(nibName:"FlowCollection",bundle:nil)
println(cellsViewController)
println(cellsViewController?.collectionView)
cell.addSubview(cellsViewController!.collectionView!)
//------------------------------------------------------------------------------------------------------
}elseif i == 0{
cell.backgroundColor =UIColor.purpleColor()
}elseif i == 1{
cell.backgroundColor =UIColor.redColor()
}else{
cell.backgroundColor =UIColor.blackColor()
}
count++
return cell
}
如果在该方法中新建 var cellsViewController:cellsCollectionViewController?
cellsViewController:cellsCollectionViewController也就是第二个collectionview的controller的引用计数在方法结束后为0被释放,而第二个collectionview视图却仍存在引用.
就会出现加载了第二个collectionview,而其datasource委托方法没有被执行的诡异情况.
- CollectionView中的一个cell中加载xib中的CollectionView 不显示cell
- tableview上cell 加载collectionview
- 多种Cell的CollectionView
- collectionview cell 拖动
- collectionView 自动调整cell大小
- collectionView reloadData 之后 cell消失
- storybord 中设置collectionView中cell的背景色无效
- iOS CollectionView加载xib CollectionViewCell
- 在collectionView中返回两个不同的cell
- collectionView(xib)
- Cocos2d-JS中CollectionView实现不同大小Cell同时显示的技巧(ListView中添加显示标签)
- tableView中cell、collectionView中cell选中后,图片加上一层高亮效果 selected highlighted
- 07 - collectionView滚到indexPath指定Cell
- collectionview 的 cell复用处理
- tableView,collectionView如何获取当前cell?
- 在Xib中的tableView里设置cell没有显示出来
- iOS开发中的collectionView
- iOS:一个Cell中设置另外一个Cell中的button
- 适配器模式
- 被困于relative中的absoulute
- 黑马程序员--集合框架
- wordpress极简搭建
- Leetcode: Number of 1 Bits
- CollectionView中的一个cell中加载xib中的CollectionView 不显示cell
- JPA常用注解
- Android 控件总结
- Merge k Sorted Lists
- springmvc + jquery datatable + ajax实现服务端动态分页查询
- c/c++对数组取地址
- uva 140 Bandwidth(全排列+递归)
- android CTS测试
- 静态网页