【发布时间】:2012-11-26 05:41:30
【问题描述】:
我试图阻止集合视图中的最后一个单元格被重新排序。本质上,我希望“添加项目”单元格始终是集合中的最后一个单元格。
有什么想法吗?
提前致谢。
编辑:我正在使用LXReorderableCollectionViewFlowLayout 使用长按手势重新排列我的单元格。
【问题讨论】:
标签: ios uicollectionview
我试图阻止集合视图中的最后一个单元格被重新排序。本质上,我希望“添加项目”单元格始终是集合中的最后一个单元格。
有什么想法吗?
提前致谢。
编辑:我正在使用LXReorderableCollectionViewFlowLayout 使用长按手势重新排列我的单元格。
【问题讨论】:
标签: ios uicollectionview
你可以试试这个……这对我有帮助……
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [array count]+1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == ([array count]+1)) {
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.text = @"your text";
headerLabel.frame = CGRectMake(110.0, 11.0, 100.0, 20.0);
[cell addSubview:headerLabel];
}
else
{
}
}
希望对你有帮助。
编码愉快。
【讨论】:
我找到了一种非常简单的方法。
The details of how to do so are here.
本教程展示了如何在 UICollectionView 中设置补充视图(页眉或页脚)。我刚刚将我的标签和按钮添加到我的自定义补充视图中,瞧!
【讨论】: