Disable user interact in a view IOS
It's exactly the same, assuming your other view is either a member or you can iterate through self.view
's array of subviews, like so:
MyViewController.h
UIView* otherView;
MyViewController.m
otherView.userInteractionEnabled = NO; // or YES, as you desire.
OR:
for (int i = 0; i < [[self.view subviews] count]; i++){ UIView* view = [[self.view subviews] objectAtIndex: i]; // now either check the tag property of view or however else you know // it's the one you want, and then change the userInteractionEnabled property.}
In swift UIView
do have property userInteractionEnabled
to make it responsive or not. To make full View unresponsive use code:
// make screen unresponsiveself.view.userInteractionEnabled = false//make navigation bar unresponsiveself.navigationController!.view.userInteractionEnabled = false// make screen responsiveself.view.userInteractionEnabled = true//make navigation bar responsiveself.navigationController!.view.userInteractionEnabled = true
for (UIView* view in self.view.subviews) { if ([view isKindOfClass:[/*"which ever class u want eg UITextField "*/ class]]) [view setUserInteractionEnabled:NO];}
hope it helps. happy coding :)