Keywindow not working in iphone 6.0 simulator

[[[UIApplication sharedApplication] keyWindow] addSubview:myView];

The above code works fine in the iPhone 5.1 simulator, but its appearance does not appear in the iPhone 6.0 simulator. What could be the problem?

+5
source share
1 answer

You need to send makeKeyAndVisable to any window you want to add subview to. For instance:

[[self window] makeKeyAndVisible];

[[[UIApplication sharedApplication] keyWindow] addSubview:view];

A key window is a window that will receive user interaction. You can check out apple docs here for makeKeyAndVisable.

+5
source

All Articles