فهرست منبع

Open Network Stream: Add a copy action when tapping and holding the cells

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Marc Etcheverry 11 سال پیش
والد
کامیت
9f194207ab
1فایلهای تغییر یافته به همراه33 افزوده شده و 0 حذف شده
  1. 33 0
      Sources/VLCOpenNetworkStreamViewController.m

+ 33 - 0
Sources/VLCOpenNetworkStreamViewController.m

@@ -182,6 +182,39 @@
     [self.historyTableView deselectRowAtIndexPath:indexPath animated:NO];
 }
 
+- (void)tableView:(UITableView *)tableView
+    performAction:(SEL)action
+forRowAtIndexPath:(NSIndexPath *)indexPath
+       withSender:(id)sender
+{
+    NSString *actionText = NSStringFromSelector(action);
+
+    if ([actionText isEqualToString:@"copy:"])
+    {
+        [UIPasteboard generalPasteboard].string = _recentURLs[indexPath.row];
+    }
+}
+
+- (BOOL)tableView:(UITableView *)tableView
+ canPerformAction:(SEL)action
+forRowAtIndexPath:(NSIndexPath *)indexPath
+       withSender:(id)sender
+{
+    NSString *actionText = NSStringFromSelector(action);
+
+    if ([actionText isEqualToString:@"copy:"])
+    {
+        return YES;
+    }
+
+    return NO;
+}
+
+- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    return YES;
+}
+
 #pragma mark - internals
 - (void)_openURLStringAndDismiss:(NSString *)url
 {