0

I am using Airplay mirroring for my iPad Application to connect Mac Screen where I want to show my app simultaneously on ipad and Mac screen. Now that I have different resolutions of my mac and ipad. How would I be able to show 2 different views. Different in sense of resolutions 1024 X 768 for iPad and 1920 X 1080 for Mac. Because I am using a lot of images as backgrounds So If Make graphic images for both the mac screen and iPad and build separate View controllers for both windows, how would I Make both windows work simultaneously ?

Asadullah Ali
  • 1,056
  • 14
  • 31

1 Answers1

1

It's just a second UIScreen that you can attach a UIWindow. You add content to it like you would any other and manage it's content the same way.

Apple provide a good example here: https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/WindowAndScreenGuide/UsingExternalDisplay/UsingExternalDisplay.html

Gary Riches
  • 2,847
  • 1
  • 22
  • 19
  • can you elaborate more? I have seen this document and it's probably not enough for me. It seems like I have to assign separate RootViewControllers to each window. and on every view controller need to update window ? Isn't it quite messy ? – Asadullah Ali Feb 24 '15 at 10:41
  • You _can_ have a separate view controller, it would be restrictive if you couldn't, but you don't _have_ to. You could add a UIView in your current UIVController to the UIWindow you attach to to the UIScreen. That way you'd have 1 UIViewController displaying content on both screens. You could break the update method out in to a separate class where you just pass it a UIView formatted for the TV ratio. When you switch screen in the iOS app you can pass a new UIView to to the TV. – Gary Riches Feb 24 '15 at 10:48
  • Thanks but I want both screens showing content simultaneously, so I am not switching the view. My app is running on both screens simultaneously. – Asadullah Ali Feb 24 '15 at 10:54
  • That's fine, a UIViewController can manage the content of 2 UIViews with no problem. Just add the UIView to the other UIScreen's UIWindow and update it as you would any other view in your UIViewController. – Gary Riches Feb 24 '15 at 10:56
  • how can I add UIView (instead of UivewController) to UIWindow ? O.o – Asadullah Ali Feb 24 '15 at 11:13
  • 1
    UIWindow is a subclass of UIView. `[myWindow addSubview:mySecondView];`. Once you have access to the second screen, create a new UIWindow and then `myWindow.screen = [UIScreen screens] lastObject];` – Gary Riches Feb 24 '15 at 11:20