Muthu Raj Muthu Raj - 1 month ago 12
Objective-C Question

disable the UIview elements from another view in ios

I am trying to disable the user interaction to the view from one view.Here is my code.

DashboardViewControler.m

if([selectedTitle isEqual:@"VIEW"])
{
LatLongViewController * latview =[[LatLongViewController alloc]init];
latview.view.userInteractionEnabled = NO;
[self performSegueWithIdentifier:@"SWRevealViewController" sender:self];
}


In the latview, I have text fields and label views.I want to disable the user interaction while above scenario matches.Any help will be appreciated.

Rin Rin
Answer
latview.view.userInteractionEnabled = NO; 

U cant do it with IBOutlet. All IBOutlet was handling in our Controller. This is my solution:

-Create new BOOL in LatLongViewController.h file:

@property BOOL editMode; 

-In DashboardViewControler.m

  if([selectedTitle isEqual:@"VIEW"])
  {
  LatLongViewController * latview =[[LatLongViewController alloc]init];
  latview.editMode = NO;
  [self performSegueWithIdentifier:@"SWRevealViewController" sender:self];
  }

-In LatLongViewController.m

    - (void)viewDidLoad {
       if(_editMode == NO){
          view.userInteractionEnabled = NO;
       }
    }

I think u should use textfield.enable = NO; if u have only one textfield in this view.

My english is bad. Sr