Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change Edit Menu in UICollectionView?
    primarykey
    data
    text
    <p>I use UICollectionView to make a small app. I just want to change Edit Menu when tap "longPress" but can not.</p> <p>Ex. Change "Cut" to "Delete".</p> <hr> <p>I implement my ActionSheet like the code below. But that's not I want because I must implement ActionSheetDelegate outside the scope of UICollectionView.</p> <p>I want to implement ActionSheet inside <code>performAction</code> method for easy to control.<br> Any suggestion? Thank you!</p> <pre><code>- (BOOL)collectionView:(QSCollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath{ QSCell *cell = [collectionView cellForItemAtIndexPath:indexPath]; UIActionSheet *deleteButton = [[UIActionSheet alloc] initWithTitle:[NSString stringWithFormat:@"Remove: %@",[collectionView.collectionData objectAtIndex:indexPath.row]] delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"OK" otherButtonTitles: nil]; [deleteButton showFromRect:CGRectMake(0, 57, 57, 20) inView:cell animated:NO]; return YES; } -(BOOL)collectionView:(QSCollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender{ return YES; } -(void)collectionView:(QSCollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender{ } //ActionSheet -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ switch (buttonIndex) { case 0: NSLog(@"Delete"); break; default: break; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload