Question

I have created a UIWindow to show a menu floating over all controllers globally. I want to set the level such that window is always visible plus user can interact with controllers behind it. Window contains a controller which will expand/contract on user tap. See the pictures below:

enter image description here enter image description here

Currently, I have tried following approach:

UIWindow *statusWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
statusWindow.windowLevel = UIWindowLevelAlert; //Have tried all three
statusWindow.hidden = NO;

[statusWindow addSubview:_gmDemo.view];//my controller's view
[statusWindow bringSubviewToFront:_gmDemo.view];

This code blocks my interaction with controllers behind it. Moreover, when I set it to UIWindowLevelNormal - 1, window is hidden but I can interact with other controllers.

Please tell me correct way to achieve my goal. Thanks.

Note: I have already read this post.

Was it helpful?

Solution

Found solution myself. Problem was UIWindow's frame as well as level. First I set level to UIWindowLevelNormal. Secondly, I have handled window's frame dynamically on menu's button tap. When menu need to be expand/contract, I appropriately increase/decrease size of UIWindow on delegate's call. That's it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top