I want to add a temporary view over the current presented viewcontroller which covers the entire screen.After some research I found that I should add this screen as a subview of current UIWindow.I used the following code.But the view is not covering the entire screen.
`UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow];
//mainWindow.frame=self.view.frame;
_autoPlayViewBackground.frame=self.view.frame;
_autoPlayViewBackground.hidden=NO;
[mainWindow addSubview:_autoPlayViewBackground];`
This code is giving a window towards a side.Any help would be a great help.
How about this?
UIWindow* window = [UIApplication sharedApplication].keyWindow;
if (!window)
window = [[UIApplication sharedApplication].windows objectAtIndex:0];
[[[window subviews] objectAtIndex:0] addSubview:myView];
Make sure whatever you want to show will be added in UIView
which is myView
. This is very important step.