Is it possible to mirror the Screen over the VGA Connector? Can't find anything about this.
Each UIWindow object (basically the top level view) is assigned a screen (UIScreen) and you can of course set the screen you want. Therefore moving the main content to a second screen is easy, but mirroring is hard. (If you don't want a lecture on why it's ugly skip until the next paragraph) I believe this is apple's intention, both because drawing the same thing twice, one with a MUCH higher resolution, and because the experience of watching the interface before entering whatever presentation mode is rather subpar in comparison to seeing nothing until the video is playing, keynote presentation has started, etc. This is something you obviously want to consider on a case by case basis, but nonetheless mirroring is a Bad Idea.
UIWindow inherits from UIView, so although I don't have much personal experience with this exact thing, you should still be able to get it to draw to a bitmap context of some kind, and then use two different UIWindows each with only an image view on a them pushing the actual pixels to their respective screens. This is considerably easier if you only want to mirror one specific custom view (and not including it's subviews) because you can have that view on the device screen, (to capture any input) and then design it in a way that you have a method to call to draw it in whatever context it's in (some drawRects might work fine as is) and the call that from a super special awesome custom subview on the other screen, which would implement drawRect to just call the method on the actual view.
Hope this helps, sorry I ranted a bit :(
I was looking for the same thing you are. Last weekend I wrote a small UIApplication category to add mirroring support. I published to code on Google Code.
http://code.google.com/p/iphoneos-screen-mirroring/
To use it, you simply have to set it up in your application delegate's app did finish lauching. Like so:
[[UIApplication sharedApplication] setupScreenMirroringOfMainWindow:mainWindow framesPerSecond:20];
I only had one chance to try it out last weekend on a big screen TV with the Apple AV output cables. The performance is not stellar, thus I would not recommend using a frame rate higher than 30 fps...
I'm trying to do something similar with an OpenGL project and I think by rendering my view once to a texture and then displaying that texture in two different windows the performance would not suffer. another approach would be to have two opengl contexts share the same framebuffer.
I also think this same technique would work with regular UIviews (as they are GL accelerated under the hood). can anyone with OpenGL experience point to an example of this?
Thanks for sharing the code. I have tried it today. This works for iPad Application. But does not work for a iphone application installed in iPad. Part of the screen appears in external display. The UIGetScreenImage API does not capture screen properly when application type is iPhone. Is there any other way of capturing screen instead of using UIGetScreenImage?
Hi,
I could not integrate the code to the xcode. I keep getting compilation references error on the CATranform3DIdentity, CATRansform3DRotation and even CADisplayLink
Could some guide me and enlighten me?
This works great -- but app just got rejected for using private API... UIGetScreenImage();
CRUD!
I think it worth adding that the QuartzCore framework is mandatory, or you'll have 4 errors at compile time.
Undefined symbols:
"_CATransform3DMakeRotation", referenced from:
-[UIApplication(ScreenMirroring) updateMirroredWindowTransformForInterfaceOrientation:] in UIApplication+ScreenMirroring.o
-[UIApplication(ScreenMirroring) updateMirroredWindowTransformForInterfaceOrientation:] in UIApplication+ScreenMirroring.o
-[UIApplication(ScreenMirroring) updateMirroredWindowTransformForInterfaceOrientation:] in UIApplication+ScreenMirroring.o
"_kCAGravityResizeAspect", referenced from:
_kCAGravityResizeAspect$non_lazy_ptr in UIApplication+ScreenMirroring.o
(maybe you meant: _kCAGravityResizeAspect$non_lazy_ptr)
"_OBJC_CLASS_$_CADisplayLink", referenced from:
objc-class-ref-to-CADisplayLink in UIApplication+ScreenMirroring.o
"_CATransform3DIdentity", referenced from:
_CATransform3DIdentity$non_lazy_ptr in UIApplication+ScreenMirroring.o
(maybe you meant: _CATransform3DIdentity$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status