Reputation: 1278
[[[UIApplication sharedApplication] keyWindow] addSubview:myView];
The above code is working fine in iPhone 5.1 simulator, but the view is not appearing in iPhone 6.0 simulator. What could be the problem?
Upvotes: 4
Views: 532
Reputation: 9703
You have to send makeKeyAndVisable to what ever window you want to add the subview to. Like so:
[[self window] makeKeyAndVisible];
[[[UIApplication sharedApplication] keyWindow] addSubview:view];
The key window is the window which will receive user interaction. You can check the apple docs here for makeKeyAndVisable.
Upvotes: 5