我想在用戶在tableView中按下一行時流一些視頻。我使用的是iOS 4.2,當我按下一行時,我聽到了聲音,但是tableview並沒有推開,你看不到視頻?我相信這是一個巨大的新手錯誤,但是...我是一個新手!提前致謝!!!使用MPMoviePlayerController並獲取聲音,但沒有視頻
-(void)tableView: (UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath {
NSString *video;
NSString *url;
NSUInteger row = [indexPath row];
video = [self.videoTitles objectAtIndex:row];
if ([video isEqualToString:@"Shimmy"]) {
url = @"http://www.andalee.com/iPhoneVideos/mov.MOV";
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:[NSURL URLWithString:url]];
[moviePlayer play];
} else if ([video isEqualToString:@"Camel"]) {
url = @"http://www.andalee.com/iPhoneVideos/mov.MOV";
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:[NSURL URLWithString:url]];
[[self view] addSubview:[moviePlayer view]];
[moviePlayer play];
}
[video release];
[url release];
}