我正在开发一个 IOS 应用程序(使用 Storyoard)。我有一个视图控制器:
//movieViewController.h
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface movieViewController : UIViewController {
MPMoviePlayerViewController *moviePlayer;
}
@property (strong, nonatomic) MPMoviePlayerViewController *moviePlayer;
-(void) playMovie;
@end
//movieViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self playMovie];
}
-(void)playMovie
{
NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"movie"
ofType:@"mov"];
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL
fileURLWithPath:videoPath]];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
}
当我运行时,我看到我的 viewController 带有一个“正在加载...”,这需要永远。