【发布时间】:2015-05-15 11:19:55
【问题描述】:
我附上了我所做的和我必须实现的目标。请指导我实现这一目标。
我已经做到了:
我想实现以下目标:
这是我的代码:
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGSize size;
if (indexPath.row == DIGIT_INT_2 || indexPath.row == DIGIT_INT_6 || indexPath.row == DIGIT_INT_7)
size = CGSizeMake(150, 68);
else if (indexPath.row == DIGIT_INT_3 || indexPath.row == 13)
size = CGSizeMake(150, 150);
else
size = CGSizeMake(68, 68);
return size;
}
【问题讨论】:
-
请分享您代码的相关部分,否则很难提供帮助。
-
@WaiHaLee 感谢先生的回复直到现在我添加了 uicollectionview 并添加了使用流布局委托方法定义的项目大小:-- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout * )collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {CGSize size; if (indexPath.row == DIGIT_INT_2 ||indexPath.row == DIGIT_INT_6 || indexPath.row == DIGIT_INT_7) {size = CGSizeMake(150, 68); }else if (indexPath.row == DIGIT_INT_3 ||indexPath.row == 13) {size = CGSizeMake(150, 150);}elsesize = CGSizeMake(68, 68);返回大小;}
-
我的意思是 edit 你的问题包括代码。这样,您就可以对代码进行格式化,使其更易于阅读。
-
你看过RFQuiltLayout吗?
-
感谢 Azat 的回复,我通过我的方式解决了。
标签: ios xcode uicollectionview uicollectionviewlayout