2

I am wanting to add a UIView above my entire app. This part is easy:

UIView* myView = /* Your custom view */;
UIWindow* currentWindow = [UIApplication sharedApplication].keyWindow;
[currentWindow addSubview:myView];

My UIView has a UIButton as a subview and I am not sure what VC to set its target to since this view can show over the entire app.

What would I set the target to for a UIButton that is part of UIWindow? Is it possible to set the target to a singleton that I have?

Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412

1 Answers1

0

One solution might be to create a "main" container vc that will always be on the screen and holds all your app's view controllers stack. There you can add all your custom subviews and connect its methods to container.

Pls check this link for more details:

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html

Also a good link, it describes a little different situation but very similar: https://spin.atomicobject.com/2015/09/02/switch-container-views/

Alex Kosyakov
  • 2,095
  • 1
  • 17
  • 25