我有collectionView。它垂直显示单元格。
在开始时,collectionView 看起来像这样
start of the collectionview
最后它看起来像这样
end of collectionView
所以它最终基本上不会显示整个单元格
集合类的代码是
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - CollectionView Datasource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return 9;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
ViewControllerCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
return cell;
}
@end
最佳答案
您必须在 Storyboard 中指定单元格大小。
关于ios - UICollectionView Vertical 最后显示一半的单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36790574/