首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

在UITableViewCell中展示快捷菜单

2013-02-25 
在UITableViewCell中显示快捷菜单- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtInd

在UITableViewCell中显示快捷菜单
- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath { return YES;}- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { return YES;}- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { if (action == @selector(copy:)) { [UIPasteboard generalPasteboard].string = [dataArray objectAtIndex:indexPath.row]; } if (action == @selector(cut:)) { [UIPasteboard generalPasteboard].string = [dataArray objectAtIndex:indexPath.row]; [dataArray replaceObjectAtIndex:indexPath.row withObject:@""]; [tbl reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone]; } if (action == @selector(paste:)) { NSString *pasteString = [UIPasteboard generalPasteboard].string; NSString *tmpString = [NSString stringWithFormat:@"%@ %@", [dataArray objectAtIndex:indexPath.row], pasteString]; [dataArray replaceObjectAtIndex:indexPath.row withObject:tmpString]; [tbl reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone]; }}

?

可以支持的菜单列表如下:

cut:

copy:

select:

selectAll:

paste:

delete:

_promptForReplace:

_showTextStyleOptions:

_define:

_addShortcut:

_accessibilitySpeak:

_accessibilitySpeakLanguageSelection:

_accessibilityPauseSpeaking:

makeTextWritingDirectionRightToLeft:

makeTextWritingDirectionLeftToRight:

在UITableViewCell中展示快捷菜单

热点排行