Преглед изворни кода

add a default File Browser

studentdeng пре 12 година
родитељ
комит
6f26164ea3
1 измењених фајлова са 11 додато и 0 уклоњено
  1. 11 0
      Classes/Global State Explorers/FLEXFileBrowserTableViewController.m

+ 11 - 0
Classes/Global State Explorers/FLEXFileBrowserTableViewController.m

@@ -20,6 +20,7 @@
 @property (nonatomic, strong) NSNumber *searchPathsSize;
 @property (nonatomic, strong) UISearchDisplayController *searchController;
 @property (nonatomic) NSOperationQueue *operationQueue;
+@property (nonatomic, strong) UIDocumentInteractionController *documentController;
 
 @end
 
@@ -247,6 +248,7 @@
             drillInViewController.title = [subpath lastPathComponent];
             [self.navigationController pushViewController:drillInViewController animated:YES];
         } else {
+            [self openFileController:fullPath];
             [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
         }
     } else {
@@ -254,4 +256,13 @@
     }
 }
 
+- (void)openFileController:(NSString *)fullPath
+{
+    UIDocumentInteractionController *controller = [UIDocumentInteractionController new];
+    controller.URL = [[NSURL alloc] initFileURLWithPath:fullPath];
+  
+    [controller presentOptionsMenuFromRect:self.view.bounds inView:self.view animated:YES];
+    self.documentController = controller;
+}
+
 @end