UITableView를 사용하고 있으므로 UICollectionView를 처음 사용하기 때문에 미리 사과드립니다.UICollectionView 셀이 화면에서 정렬되어 있습니까?
어쨌든 몇 가지 간단한 코드가 있지만 몇 가지 이유 때문에 아직 익숙하지 않은 일부 셀은 다음 단계로 이동하지 않고 화면에 표시되지 않습니다.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
array = [ [NSMutableArray alloc] initWithObjects:@"Apple", @"Is", @"The", @"Bomb", @".com", @":D", nil];
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
return 5.0;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return array.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
UILabel *label = (UILabel *)[cell viewWithTag:100];
label.text = [array objectAtIndex:indexPath.row];
[cell.layer setBorderWidth:2.0f];
[cell.layer setBorderColor:[UIColor whiteColor].CGColor];
[cell.layer setCornerRadius:10.f];
return cell;
}
은 "폭탄"과 ".COM"와 셀에 무슨 일이? 왜 화면이 잘리지 않습니까?
컬렉션보기의 프레임은 무엇입니까? 그걸 어떻게 세웠습니까? – rdelmar