0

I am using below code to display a window over movie player controller:

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

Its working fine in iOS 5 but it stopped working in iOS 6. Even window is not displaying in iOS 6. So please can you suggest me the solution for this.

Thanks

Mitesh Khatri
  • 3,935
  • 4
  • 44
  • 67

4 Answers4

1

Add [self.window makeKeyAndVisible] to your AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

method and you can use this code

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

to your

- (void)viewDidAppear:(BOOL)animated

method in your ViewController

alecnash
  • 1,750
  • 1
  • 18
  • 42
0

try this:

[[self window] makeKeyAndVisible];

[[[UIApplication sharedApplication] keyWindow] addSubview:view];
Krishna Kumar
  • 1,652
  • 9
  • 17
  • Where I write this code? Before add the subview? if I write makekeyvisible in window then it shows error for window. and if I write appdelegate.window then it does not work. – Mitesh Khatri Aug 19 '13 at 13:02
0

Try it after "appdidFinishLaunching:" finished! May solve it.

wangrui
  • 3
  • 1
0

[[UIApplication sharedApplication] keyWindow] // available only on main thread

Roman Filippov
  • 2,289
  • 2
  • 11
  • 17