将视频添加到iPhone应用程序 [英] Adding video to an iPhone application

查看:106
本文介绍了将视频添加到iPhone应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将视频添加到iPhone应用程序。使用iPhone SDK 3.2.5?
我没看到实际的视频,但我可以听到它播放。

How do I add a video to an iPhone app. using iPhone SDK 3.2.5? I dont see the actual video but I can hear it playing.

这是代码:

-(void) viewDidLoad{
    NSBundle *bundle=[NSBundle mainBundle];
    NSString *moviePath = [bundle pathForResource:@"Facebook" ofType:@"mp4"];
    NSURL *movieURL=[[NSURL fileURLWithPath:moviePath] retain];
    MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    theMovie.scalingMode = MPMovieScalingModeAspectFill;
    [theMovie play];
    [super viewDidLoad];
}


推荐答案

你需要设置框架为你MPMoviePlayerController并将其添加到您的视图:

You need to set the frame for you MPMoviePlayerController and add it to your view:

theMovie.view.frame = CGRectMake(0.0, 0.0, 320.0, 480.0);
[self.view addSubview:theMovie.view];

这篇关于将视频添加到iPhone应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆