Q:

How to Disable UserInteraction on SuperView when Subview is displayed?

I have created a Custom UIView, added it as subview to ViewController and displayed it as PopUp. Now, what i want is that when UIView is displayed, the SuperView.
i.e my viewController should Disable user interaction.
I have tried below code but it disables whole view including PopUp.So how can i disable UserInteraction.
userInteractionEnabled = NO;
Please give me some idea.
Thank you.

A:

You could also add the view as a subview to the application window and use a transparent background, such as:
CGSize popupSize = CGSizeMake(200, 200);
UIWindow *win = [[[UIApplication sharedApplication] delegate] window];
CGRect rect = CGRectMake(win.bounds.size.width/2-popupSize.width/2, win.bounds.size.height/2-popupSize.height/2, popupSize.width, popupSize.height);
UIView *myCustomView = [[MyCustomView alloc] initWithFrame:rect];
[win addSubView:myCustomView];
self.view.userInteractionEnabled = NO;

I haven't tested this code, but I've added stuff to window before. To remove the view, just write:
[myCustomView removeFromSuperView];

