소스 검색

Show copy menu from long press on network history cells.

Ryan Olson 11 년 전
부모
커밋
5f9a61c755
1개의 변경된 파일21개의 추가작업 그리고 0개의 파일을 삭제
  1. 21 0
      Classes/Network/FLEXNetworkHistoryTableViewController.m

+ 21 - 0
Classes/Network/FLEXNetworkHistoryTableViewController.m

@@ -309,6 +309,27 @@
     [self.navigationController pushViewController:detailViewController animated:YES];
     [self.navigationController pushViewController:detailViewController animated:YES];
 }
 }
 
 
+#pragma mark - Menu Actions
+
+- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    return YES;
+}
+
+- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender
+{
+    return action == @selector(copy:);
+}
+
+- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender
+{
+    if (action == @selector(copy:)) {
+        FLEXNetworkTransaction *transaction = [self transactionAtIndexPath:indexPath inTableView:tableView];
+        NSString *requestURLString = transaction.request.URL.absoluteString ?: @"";
+        [[UIPasteboard generalPasteboard] setString:requestURLString];
+    }
+}
+
 - (FLEXNetworkTransaction *)transactionAtIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView
 - (FLEXNetworkTransaction *)transactionAtIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView
 {
 {
     FLEXNetworkTransaction *transaction = nil;
     FLEXNetworkTransaction *transaction = nil;