我在顯示一個UITableView的tmp目錄的內容,但不能得到每個單元的文件路徑。如何在UITableView中獲取視頻的文件路徑? (tmp目錄)
當按下電池,我的應用程序應該發揮與MPMoviePlayer的文件,但並非如此。
這是我到目前爲止有:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *tmpDirectory = NSTemporaryDirectory();
fileList = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:tmpDirectory error:nil]; //nsarray
NSString *movieURL = [fileList objectAtIndex:indexPath.row];
NSURL *url = [NSURL URLWithString:movieURL];
_moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[self presentModalViewController:_moviePlayerViewController animated:YES];
}
的NSLog給我視頻的名稱,而不是路徑。我覺得我正在從睡眠不足的角度思考這個問題。
哇。非常感謝,我不能相信我忘記了stringByAppendingPathComponent。 – CokePokes
@CokePokes:高興,感謝您的評論:) –