简体   繁体   English

如何在iOS中的MPMoviePlayerContoller视图上添加自定义右栏按钮

[英]how to add custom right bar button on MPMoviePlayerContoller view in iOS

我试过了

self.navigationItem.righBarButton = customView;

Because of the spare description what you exactly want to achieve in respect to MPMoviePlayerController, I take your question simply as referring to the general "How do I add a custom view as rightBarButtonItem?". 由于有多余的描述,对于MPMoviePlayerController而言,您确切想要实现的是什么,因此,我将您的问题简单地提到一般的“如何将自定义视图添加为rightBarButtonItem?”。

The answer is, you simply have to create a UIBarButtonItem with your custom view and assign the result as rightBarButtonItem like this: 答案是,您只需要使用自定义视图创建一个UIBarButtonItem并将结果分配为rightBarButtonItem,如下所示:

[self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithCustomView:customView]];

A similar question was also already answered here for example. 例如, 这里也已经回答类似的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM