3

I'm working on an app, that uses external display. I have a lot of different views and controls that are created dynamically according to data that i get from server.

So lets say that this view was created dynamically and is displayed on iPad screen (not full screen):

enter image description here

Off-course it is hard to control and detect which control value has been changed by the user, specially such as scroll viewers and slides to show the change in real time on external display.

Is there a way not to add events to each control, and then modify the control instance on the external screen, but create just a dummy-reflection that will display real time changes of real UIView on iPad?

Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
Developer
  • 4,158
  • 5
  • 34
  • 66

1 Answers1

3

AirPlay mirroring is what you are looking for. AirPlay can operate in two modes:

  • the entire screen is mirrored to the AirPlay device
  • there are two UIWindow/UIScreen's to work with, and one of them is mirrored.

Since the view you want to mirror is not fullscreen. You have to go for second option. Unfortunately, there is no technical way to have a single instance of a UIView show on both of the windows.

Option 1 - Twin views

If you want the same thing to show on both screens, you need to create two instances of the same UIView, and add them respectively to the two windows, and then update both of them as they change.

Option 2 - UISnapshotting

Another option is to setup a timer and update the contents of the window you want to present a couple of times per second. With iOS 7 Apple introduced UISnapshotting and they claim it's really fast, much faster than renderInContext:. I haven't researched if its performance is high enough to call it many times per second but it should work.

UIView *snapshot = [view snapshotViewAfterScreenUpdates:YES];

This method captures the current visual contents of the screen from the render server and uses them to build a new snapshot view. You can use the returned snapshot view as a visual stand-in for the screen’s contents in your app. (...) this method is faster than trying to render the contents of the screen into a bitmap image yourself.

Moreover, have a look into links below. They should give you some insights and point to the right direction.

Community
  • 1
  • 1
Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143