2014-09-08 2 views
2

컬렉션보기에 UIMenu를 표시하려고합니다.iOS8에서 UICollectionView 메뉴를 표시 할 수 없습니다.

내가 설정 내 메뉴

UIMenuItem* deleteItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"DELETE", @"Supprimer") action:@selector(deleteShow:)]; 
UIMenuItem* archiveItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"ARCHIVE", @"Archiver") action:@selector(archiveShow:)]; 
UIMenuItem* unarchiveItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"UNARCHIVE", @"Restaurer") action:@selector(unArchiveShow:)]; 

[[UIMenuController sharedMenuController] setMenuItems:@[deleteItem,archiveItem,unarchiveItem]]; 

했습니다 그리고 난 내 컬렉션보기 위임 다음 방법을 구현했습니다 :

- (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath 
- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender 
- (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender 

처음 두 항상 YES를 반환합니다. 길게 누르면 메뉴가 표시되지 않습니다. 표준 잘라 내기/복사/붙여 넣기 메뉴조차도 아닙니다. 누구나 이런 경험이 있습니까?

미리 감사드립니다.

답변

2

이 문제는 다소 시간을 낭비했습니다. UICollectionViewCell의 하위 클래스에서 "deleteShow :"메서드 등을 구현하지 않으면 메뉴 항목이 표시되지 않습니다.

관련 문제