@@ -64,6 +64,10 @@ - (void)viewDidLoad
64
64
clickSound = [[AVAudioPlayer alloc ] initWithContentsOfURL: fileURL error: nil ];
65
65
[clickSound prepareToPlay ];
66
66
67
+ UIRefreshControl *refreshControl = [[UIRefreshControl alloc ] init ];
68
+ [refreshControl addTarget: self action: @selector (refresh: ) forControlEvents: UIControlEventValueChanged];
69
+ [self .filesTableView addSubview: refreshControl];
70
+
67
71
// Detect if the app has ever been used before. If it has then just continue starting up.
68
72
69
73
if ([[NSUserDefaults standardUserDefaults ] boolForKey: @" HasLaunchedOnce" ])
@@ -393,7 +397,21 @@ -(void)setupDirectoryArray
393
397
NSString *updatedURLResult = [urlResult stringByReplacingOccurrencesOfString: @" " withString: @" %20" ];
394
398
395
399
[self .directoryArray addObject: [Directory fileName: updatedfilenamestring fileType: typeresult fileURL: updatedURLResult]];
400
+
401
+ NSLog (@" filename: %@ " , updatedfilenamestring);
402
+ NSLog (@" filetype: %@ " , typeresult);
403
+ NSLog (@" fileurl: %@ " , updatedURLResult);
404
+
396
405
}
406
+
407
+ NSLog (@" array: %@ " , self.directoryArray );
408
+
409
+ // NSUInteger indexObject = [self.directoryArray indexOfObject: @"index.php"];
410
+
411
+ // [self.directoryArray removeObjectAtIndex:indexObject];
412
+
413
+ [self .directoryArray removeObject: [Directory fileName: @" index.php" fileType: @" php" fileURL: @" http://dev.quade.co/index.php" ]];
414
+
397
415
}
398
416
399
417
@@ -727,7 +745,6 @@ - (IBAction)openButtonPressed:(id)sender
727
745
}
728
746
}
729
747
730
- // This code is commented out because it's a work in progress.
731
748
732
749
if ([currentType isEqualToString: @" txt" ]) {
733
750
@@ -830,4 +847,13 @@ - (void)startClick
830
847
[clickSound prepareToPlay ];
831
848
}
832
849
850
+ // This method handles the pull to refresh in the table view. It is all defined in the viewDidLoad.
851
+
852
+ - (void )refresh : (UIRefreshControl *)refreshControl
853
+ {
854
+ [self applicationDidUpdateDirectory ];
855
+ [filesTableView reloadData ];
856
+ [refreshControl endRefreshing ];
857
+ }
858
+
833
859
@end
0 commit comments