UICollectionView
을 페이지 당 2x3 격자로 배치하려고합니다. 여기에 지금까지 무엇입니까 무엇 : 당신이 볼 수 있듯이2x3 그리드를 생성하기 위해 UICollectionView를 배치하는 문제 iOS
다음 "페이지"내가 원하지 않는 오른쪽에서 엿보는된다. 나는 내 너비가 항상 320pts (iPhone
만)가 될 것이라는 것을 알면 내 셀이 130pts가되도록 할 것이라고 생각했다. width
과 15pts가 양쪽에있다. 레이아웃 delegate
에 대한
코드 :
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(130, 130);
}
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout
insetForSectionAtIndex:(NSInteger)section {
return UIEdgeInsetsMake(20.0f, 15.0f, 20.0f, 15.0f);
}
또한 cellForItemAtIndexPath :
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath{
CustCollectionViewCell *cell =
[collectionView dequeueReusableCellWithReuseIdentifier:kReuseID
forIndexPath:indexPath];
//Set up list name label
cell.LblListName.font = [self getDefaultFontWithSize:15.0f];
cell.LblListName.textColor = fontAndTertiaryColor;
cell.LblListName.textAlignment = NSTextAlignmentCenter;
cell.LblListName.text = @"Failtron";
//cell.LblListName.adjustsFontSizeToFitWidth = YES;
cell.backgroundColor = secondaryColor;
cell.parallaxIntensity = kParallaxMotion;
[Utilities createViewBorder:cell];
return cell;
}
내가 인세
CSS
에
padding
처럼 행동 것이라고 생각
하지만 난 하나와 마크 떨어져있어 믿고, 나는 또한 UIStoryboard
에서 내 레이아웃이 흐르도록 설정되어 있음을 알아야합니다. 관련 코드가 누락 되었다면 알려주십시오.이 코드는 UICollectionView
의 첫 번째 시도입니다. 나는 이것을 scroll
horizontally
으로 원한다.
그래서 collectionview를 가로로 스크롤하려고하지만 다음 페이지를보고 싶지는 않습니다. 그게 맞습니까? – jhilgert00
예, 맞습니다. –