@@ -55,7 +55,6 @@ - (void)viewDidLoad {
55
55
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
56
56
57
57
[self setPath: [paths objectAtIndex: 0 ]];
58
-
59
58
[self loadContents ];
60
59
61
60
[navItem setLeftBarButtonItem: [[[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target: self action: @selector (back )] autorelease ]];
@@ -71,7 +70,8 @@ - (void)back {
71
70
72
71
- (void )setEditing : (BOOL )editing animated : (BOOL )animated {
73
72
[super setEditing: editing animated: animated];
74
- [table setEditing: editing animated: YES ];
73
+
74
+ [table setEditing: editing animated: YES ];
75
75
}
76
76
77
77
#pragma mark -
@@ -84,7 +84,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
84
84
85
85
- (NSInteger )tableView : (UITableView *)tableView numberOfRowsInSection : (NSInteger )section {
86
86
// Return the number of rows in the section.
87
- return [[ self contents ] count ];
87
+ return [self . contents count ];
88
88
}
89
89
90
90
// Customize the appearance of table view cells.
@@ -140,7 +140,6 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd
140
140
[fileManager removeItemAtPath: imagePath error: NULL ];
141
141
142
142
[self setContents: nil ];
143
-
144
143
[self loadContents ];
145
144
146
145
[table deleteRowsAtIndexPaths: [NSArray arrayWithObject: indexPath] withRowAnimation: UITableViewRowAnimationFade];
@@ -174,14 +173,18 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
174
173
}
175
174
176
175
- (void )tableView : (UITableView *)tableView didSelectRowAtIndexPath : (NSIndexPath *)indexPath {
177
- [table deselectRowAtIndexPath: indexPath animated: TRUE ];
176
+ [table deselectRowAtIndexPath: indexPath animated: YES ];
178
177
179
178
NSString *contentURL = [NSString stringWithFormat: @" %@ .mp4" , [self .path stringByAppendingPathComponent: [self .contents objectAtIndex: [indexPath indexAtPosition: 1 ]]]];
180
179
181
180
MPMoviePlayerViewController *moviePlayerViewController = [[MPMoviePlayerViewController alloc ] initWithContentURL: [NSURL fileURLWithPath: contentURL]];
182
181
if (moviePlayerViewController) {
183
182
[self presentMoviePlayerViewControllerAnimated: moviePlayerViewController];
184
183
[moviePlayerViewController.moviePlayer setMovieSourceType: MPMovieSourceTypeFile];
184
+
185
+ if ([moviePlayerViewController.moviePlayer respondsToSelector: @selector (setAllowsAirPlay: )]) {
186
+ [moviePlayerViewController.moviePlayer setAllowsAirPlay: YES ];
187
+ }
185
188
186
189
[[NSNotificationCenter defaultCenter ] addObserverForName: MPMoviePlayerPlaybackDidFinishNotification object: moviePlayerViewController queue: nil usingBlock: ^(NSNotification *notification) {
187
190
[[NSNotificationCenter defaultCenter ] removeObserver: self ];
0 commit comments