【发布时间】:2012-10-03 10:23:22
【问题描述】:
单击一行后,我想播放 youtube 电影。我正在按照以下方式进行操作。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"showVideo" sender:indexPath];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSIndexPath *indexPath = (NSIndexPath *)sender;
Video *video = [self.fetchedResultsController objectAtIndexPath:indexPath]; // ask NSFRC for the NSMO at the row in question
if ([segue.identifier isEqualToString:@"showVideo"]) {
NSLog(@"url is: %@",video.url);
[segue.destinationViewController setVideoURL:[NSURL URLWithString:video.url]];
}
}
当我单击一个单元格时,它会转到下一个屏幕,但它保持空白。虽然我的 NSLog 给了我正确的 url。
有人可以帮忙吗?
亲切的问候。
编辑
当我使用http://www.google.be 作为网址时,它可以工作。 但是当我使用这个网址时:http://www.youtube.com/v/066PWBKrh6k&autoplay=1 它不会。
【问题讨论】:
-
setVideoURL实际上是做什么的?如果它是一个简单的 setter 方法并且没有触发UIWebView请求加载,那么这将是您的根本问题。 -
感谢您的回答。但请检查我的编辑。
-
当您将该 URL 放入您的浏览器时会发生什么?它当然不会引导我观看移动 safari 中的视频。
-
我认为链接是问题。
标签: objective-c ios uiwebview youtube