0

CollectionView から (popOver で) セルを選択すると、(Storyboards と imageViews と CollectionViews を使用して) 画像が表示された mainView があります。

別の (UiCollectionView を含むポップオーバー) を作成して、画像を選択し、その 2 番目の画像を既に表示されている画像の上に配置するにはどうすればよいですか?

4

1 に答える 1

0
#pragma mark - UICollectionViewDataSource

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    // Return the number of sections.
   // return [_carImages count] / 2;
    return 1;
}






- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [_carImages count];
}








- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{

  //  CellTasteCollectionView *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
   // image = [[UIImage imageNamed:[_carImages objectAtIndex:indexPath.row]];
  //  cell.imageView.image = image;

   // return cell;

    NSLog(@"INDEX PATH roe %@",[_carImages objectAtIndex:indexPath.row]);

    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
/*




 UIImageView *brickAnim = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile: imageFilePath]];
 brickAnim.frame = CGRectMake(0, 0, 62, 57);
 [cell.contentView addSubview:brickAnim];
 cell.layer.borderColor=[UIColor whiteColor].CGColor;
 cell.layer.borderWidth=2.0;
  */  cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:[_carImages objectAtIndex:indexPath.row]]];
    return cell;

   /* MyCollectionViewCell *myCell = [collectionView
                                    dequeueReusableCellWithReuseIdentifier:@"MyCell"
                                    forIndexPath:indexPath];

    UIImage *image;
    int row = [indexPath row];

    image = [UIImage imageNamed:_carImages[row]];



    myCell.imageView.image = image;

    return myCell;*/
}







- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
  //  UIImage *image =[UIImage imageNamed: [_carImages objectAtIndex:indexPath.row]];
    return CGSizeMake(40, 40);
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
   return UIEdgeInsetsMake(20, 20, 20, 20);
}




#pragma mark -
#pragma mark UICollectionViewFlowLayoutDelegate





/*-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UIImage *image;
    int row = [indexPath row];

    image = [UIImage imageNamed:_carImages[row]];

    return image.size;
}*/






- (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition{


}
于 2013-04-26T10:16:19.627 に答える