开发者

How can I set the content of my external screen's window?

I am very new to Objective C and this is my first post. I have been trying various methods to mirror my iPads display to an external screen.

I have code that successfully launches an external window. What I would 开发者_运维技巧like to do is show the contents of my main window on the external window.

I am using a tabBarController and its view is added as a subview to my main window at startup as follows:

[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];

This works fine. I subsequently then try to add the same view to my external window.

[externalWindow addSubview:tabBarController.view];

This makes the contents of the tabBarController appear in the external window but my main window blanks out. Obviously this is incorrect.

For those who are familiar with it I am basing my solution on that devised by Matt Legend Gemmell. I can replicate the example which uses static content of the external window easily. The big issue for me is how do I set its content dynamically to what I have in my main window?

Can anybody help please?


That is expected. UIViews can only have one parent view. In this case, you moved tabBarController.view from your device window to the external window.

What you want to do is instantiate a new view for your external display, not use the instance that you are using in your main (device) window, which you will notice, is the same as what Matt Gemmel did in his guide.

It might be helpful for you to read up on the official guide from Apple. Displaying Content on an External Display.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜