Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 向MoviePlayer添加导航栏_Iphone_Ios_Ipad_Mpmovieplayercontroller - Fatal编程技术网

Iphone 向MoviePlayer添加导航栏

Iphone 向MoviePlayer添加导航栏,iphone,ios,ipad,mpmovieplayercontroller,Iphone,Ios,Ipad,Mpmovieplayercontroller,我正试图找出我能用iPad做些什么来播放视频。下面是UIButton操作的代码 - (IBAction)playClick:(id)sender { NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"video3" ofType:@"m4v"]; NSURL *movieURL = [NSURL fileURLWithPath:moviePath]; MPMovie

我正试图找出我能用iPad做些什么来播放视频。下面是UIButton操作的代码

- (IBAction)playClick:(id)sender {
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"video3" ofType:@"m4v"];
NSURL  *movieURL = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];
MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
}

如上所示,我确实有一个电影屏幕。我想知道是否可以在电影屏幕的顶部(在“完成”上方)或底部(在控制器下方)添加导航栏,以便在用户播放视频时添加一些操作?我想可能和我想做的事有关


谢谢您的帮助。

您可以使用

UIBarButtonItem *button = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(yourButtonAction:)]; 
moviePlayer.navigationItem.rightBarButtonItem = button; 
根据需要定制这些按钮

试试这个,希望有意义


关于

导航栏已经在那里了!!你的意思是你需要添加更多的按钮项目吗?谢谢。事实上,我已经尝试过了,下面是“此主题”的可用提示。但是除了“完成”按钮之外,从来没有出现过。我想下面的网站有一个sharedApplication的示例。