0
我有一個UICollectionView,顯示的圖像數量與傳遞的圖像數量一樣多。將UIImage複製到剪貼板上水龍頭
我想讓它在點擊圖片時將圖片複製到剪貼板。
任何幫助將不勝感激。
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
CollectionViewCell *Cell = [collectionView
dequeueReusableCellWithReuseIdentifier:@"ImagesCell"
forIndexPath:indexPath];
UIImage *image;
int row = indexPath.row;
//set image of this cell
image = [UIImage imageNamed:localImages.imageFiles[row]];
Cell.imageCell.image = image;
//enable touch
[Cell.imageCell setUserInteractionEnabled:YES];
Cell.imageCell.tag = row;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureRecognizer:)];
[tapGesture setNumberOfTapsRequired:1];
[Cell.imageCell addGestureRecognizer:tapGesture];
return Cell;
}
- (void)tapGestureRecognizer:(UITapGestureRecognizer *)sender
{
NSInteger string = (sender.view.tag);
NSLog(@"this is image %i",string);
UIImage *copiedImage = I don't know what to put here..
[[UIPasteboard generalPasteboard] setImage:copiedImage];
}