标签:
//长按是否出现编辑菜单(Cut Copy Paste)
- (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender
{
NSString * selName=NSStringFromSelector(action);
//菜单中只会出现copy
if ([selName isEqualToString:@"copy:"]) {
return YES;
}
return NO;
}
- (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender
{
//可以执行一些拷贝粘贴等操作
//详细的东西请看 UIPasteboard
//点击Copy要执行的方法
NSString * selName=NSStringFromSelector(action);
NSLog(@"%@",selName);
}
标签:
原文地址:http://www.cnblogs.com/tongyuling/p/4885561.html