I have requirement like inside the view I need to push some other view controllers. For that I tried to add a one window as subview for that particular view then I have given the desired view controller to root view controller for that window. It is showing correctly but the rootviewcontroller is starting from screen (0, 0) point instead of within the window.
In this picture red color is the view controller and gray one is the view with the origin (0, 100). Below is the code I have tried.
UIWindow *insideWindow = [[UIWindow alloc] initWithFrame: CGRectMake(0, 100, _windowView.frame.size.width, _windowView.frame.size.height)];
insideWindow.backgroundColor = [UIColor yellowColor];
insideWindow.windowLevel = UIWindowLevelNormal;
insideWindow.hidden = NO;
insideWindow.clipsToBounds = YES;
insideWindow.bounds = _windowView.bounds;
_windowView.clipsToBounds = YES;
[_windowView addSubview: insideWindow];
SecondViewController *s = [SecondViewController new];
s.view.bounds = CGRectMake(0, 100, _windowView.frame.size.width, _windowView.frame.size.height);
insideWindow.rootViewController = [SecondViewController new];
[insideWindow makeKeyAndVisible];
It is not a duplicate with how to add multiple UIWindows. Here I can able to add the multiple windows But the problem is inside window the viewcontrollers are not setting properly.