简体   繁体   English

Xamarin iOS的自定义视频页面

[英]Custom video page for xamarin ios

I create some project that consists from videoplayer. 我创建了一些由视频播放器组成的项目。 For Xamarin android I implemented through messaging center. 对于Xamarin android,我是通过消息传递中心实现的。

On android : android上

Page (xamarin forms) -> ( click button and sending message to MainActivity) -> calling MyVideoActivity via intent 页面 (xamarin表单) ->单击按钮并将消息发送到MainActivity) ->通过意图调用MyVideoActivity

With android all works perfectly. 与android的所有作品完美。

But I am newbie with ios and xamarin ios also. 但是我还是ios和xamarin ios的新手。

And I don't know is this real to implement the same in xamarin ios through messaging center ? 而且我不知道通过消息传递中心xamarin ios中实现相同功能是真的吗? Also I would like use .xib file(with ui, taken from Xcode). 我也想使用.xib文件(带有ui,取自Xcode)。 I am not sure how to implement it. 我不确定如何实施。 I would like to do it through messaging center -> calling custom ViewController with my .xib file. 我想通过消息中心->用.xib文件调用自定义ViewController来完成此操作。 Is it real? 这是真的吗?

ps I've found some example with PageRenderer , but don't investigate it. ps我已经找到了PageRenderer的一些示例,但是请不要进行调查。 I am not sure that it will be suitable for me. 我不确定它是否适合我。

Call the following methods in your MessagingCenter.Subscribe lambda: 在您的MessagingCenter.Subscribe调用以下方法。 MessagingCenter.Subscribe lambda:

XIB-based ViewController: 基于XIB的ViewController:

var vc = new XIBBasedViewController();
// Set any public properties / call methods on your `XIBBasedViewController`
InvokeOnMainThread(() => UIApplication.SharedApplication.Windows[0].RootViewController.PresentViewController(vc, true, null));

Storyboard-based ViewController: 基于情节提要的ViewController:

var storyboard = UIStoryboard.FromName("StoryBoardFileNameMinusExtension", null);
var vc = storyboard.InstantiateViewController("AStoryBoardIDAssignedToYourViewController") as AViewControllerSubClass;
// Set any public properties / call methods on your `AViewControllerSubClass`
InvokeOnMainThread(() => UIApplication.SharedApplication.Windows[0].RootViewController.PresentViewController(vc, true, null));

Note : A good place to setup your messaging center subscribes is in the FinishedLaunching of the AppDelegate class. 注意 :设置消息传递中心订阅的一个好地方是AppDelegate类的FinishedLaunching

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

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