【发布时间】:2011-03-21 00:13:56
【问题描述】:
在我的 iPhone 应用程序中,用户可以单击表格单元格,然后电影将开始播放。这部电影是我项目中“/Resources/myMovie.m4v”下的本地文件。我不知道如何正确链接到它。
我找到了这段代码,但它似乎不起作用:
NSString *rootPath = [[NSBundle mainBundle] resourcePath];
NSString *filePath = [rootPath stringByAppendingPathComponent:@"myMovie.m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath:filePath isDirectory:NO]];
感谢您的帮助!
【问题讨论】:
标签: iphone objective-c ios ios4 mpmovieplayercontroller