首页 > 移动平台 > 详细

iOS collection长按编辑功能

时间:2015-10-16 16:49:43      阅读:267      评论:0      收藏:0      [点我收藏+]

//长按是否出现编辑菜单(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);

}

 

iOS collection长按编辑功能

原文:http://www.cnblogs.com/tongyuling/p/4885561.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!