Collection Reuseable View未显示UILabel和UITextField

时间:2014-06-10 11:10:51

标签: ios objective-c uitableview uicollectionview

我的UICollectionView出了问题。

我在我的集​​合视图中添加了一个50的标题,所以我可以在顶部添加一个UILabel和一个UITextField。问题是当我运行代码时它没有出现:

我的故事板:

enter image description here

在ios模拟器中会发生什么:

enter image description here

感谢任何可以提供帮助的人!

2 个答案:

答案 0 :(得分:0)

enter image description here

尝试创建集合视图的这个序列

答案 1 :(得分:0)

将其放入collectionView.m文件。

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
[Your header cocoa file] *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"ObjectCVHeader" forIndexPath:indexPath];
return headerView;
}

//您需要创建一组UICollectionReusableView的.h.m文件。之后,将它们与标题视图链接。