Can anyone help me understand the difference between the following two lines:
[UIApplication.sharedApplication.delegate.window addSubview:myView];
The simplest setup is to just have one UIWindow. Usually that window is kept as a property on your app delegate. The keyWindow is the one that is designated to receive keyboard and other non-touch related events. Only one window at a time may be the key window. So if you add a 2nd window and make it the keyWindow (via [window makeKeyAndVisible]), your lines return different windows!