1
UICollectionView
을 통해 메인 아이폰 화면에 9 개의 사진 만 표시하려고합니다. 하지만 디스플레이에 문제가 있습니다. 내 첫 그림은 항상 2 번 반복됩니다 (1 번 행의 1 번 위치와 2 번 위치).iOS : indexPath.row, UICollectionView 및 이미지
내 코드에 문제가 있습니까?
// Define the number of Cell.
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return 9; }
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
static NSString *IdCell = @"Cell";
SSCollectionViewCell *cell = (SSCollectionViewCell *) [collectionView dequeueReusableCellWithReuseIdentifier: IdCell forIndexPath: indexPath];
int imageNumber = indexPath.row % 9;
cell.imageView.image = [UIImage imageNamed: [NSString stringWithFormat:@"M2_img_%[email protected]", imageNumber]];
return cell;
}
코드가 잘 보이는 경우 ... 이미지 [email protected] 및 [email protected]을 확인 – samfisher
[부정확 제거 코멘트] – Pinwheeler
내 사진을 확인하고 올바르게 이름이 지정됩니다. .. :( –