一转眼又是忙一个多月,夏天就在不知不觉的加班中过去了,做的东西也遇到了很多坑,由于业务流程不熟也被怼过,虽然很不爽,但是终究还是自己的锅,所以,还是多多记录,多多请教,不要总有逃避的想法,很不好。
下面就遇到的问题做个总结,也方便以后的问题解决。
一、collectionView中的cell从右向左排列
项目中使用的方法是让collectionView直接翻转180°,然后再让cell翻转180°,这样就巧妙地让完成了从右向左的布局。代码如下:
UICollectionView *collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width,167) collectionViewLayout:layout];
collectionView.backgroundColor = [UIColor clearColor];
collectionView.delegate = self;
collectionView.dataSource = self;
collectionView.scrollsToTop = NO;
collectionView.showsVerticalScrollIndicator = NO;
collectionView.showsHorizontalScrollIndicator = NO;
[collectionView registerClass:[CCCollectionViewCellSpeak class] forCellWithReuseIdentifier:@"cell"];
collectionView.contentInset = UIEdgeInsetsMake(0, 5.f, 0, 0.f);
collectionView.transform = CGAffineTransformMakeScale(-1, 1);
collectionView;
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
CCCollectionViewCellSpeak *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
[cell loadwith:self.dataArr[indexPath.item] showNameAtTop:NO];
cell.transform = CGAffineTransformIdentity;
if (!self.isLandSpace)
{
cell.transform = CGAffineTransformMakeScale(-1, 1);
}
return cell;
}
网友评论