【发布时间】:2016-01-04 07:34:40
【问题描述】:
我正在使用 uicollection 视图以网格视图格式显示图像。我可以显示单元格,但 iPad 的高度和宽度没有增加,它只显示为小块。请告诉我如何制作动态的。
[![在此处输入图片描述][1]][1]
我已使用以下代码使其动态化。
pragma mark 集合视图布局的东西
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
if (collectionView==self.album_collection_view) {
return 2.0;
}
else
return 2.0;
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
if (collectionView==self.album_collection_view) {
return 2.0;
}
else
return 2.0;
}
// Layout: Set Edges
- (UIEdgeInsets)collectionView:
(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
// return UIEdgeInsetsMake(0,8,0,8); // top, left, bottom, right
if (collectionView==self.album_collection_view) {
return UIEdgeInsetsMake(5,0,0,0);
}// top, left, bottom, right
else
return UIEdgeInsetsMake(5,0,0,0);
}
请告诉我如何解决这个问题?
【问题讨论】:
标签: ios objective-c xcode ipad autolayout