Not able to Hide controls using setHidden property from another class?
I am invoking PickerView from Employee View.
Following is code in my didSelect method of tableView in Employee class.
pickView = [[PickerView alloc] initWithNibName:@"PickerView" bundle:nil];
[pickView.pickerView setHidden:YES];
[pickView.datePicker setHidden:YES];
switch (indexPath.row)
{
case 0:
pickView.pickerArray = [[NSMutableArray alloc] initWithObjects:@"ML",@"M",@"M SL",@"ME",@"ME SL",@"S",@"SB",@"SH",@"ST",@"S SL",@"SH SL",@"ST SL",@"ND",@"CAE",@"EDW",@"NSW", nil];
pickView.title = @"Select Taxcode";
[pickView.pickerView setHidden:NO];
break;
case 1:
[pickView.datePicker setHidden:NO];
pickView.title = @"Pay Period";
break;
default:
break;
}
[self.navigationController pushViewController:pickView animated:YES];
I am not able to see the controls in PickerView. I have kept all controls Hidden from IB. Now when I clic开发者_开发百科k 1st cell in Employee's table View then only 1 control should be visible.
What could be the problem?
Try this code in Switch case. Le me know if you still have some problems with this.
switch (indexPath.row)
{
case 0:
{
pickView.pickerArray = [[NSMutableArray alloc] initWithObjects:@"ML",@"M",@"M SL",@"ME",@"ME SL",@"S",@"SB",@"SH",@"ST",@"S SL",@"SH SL",@"ST SL",@"ND",@"CAE",@"EDW",@"NSW", nil];
pickView.title = @"Select Taxcode";
[pickView.pickerView setHidden:NO];
break;
}
case 1:
{
[pickView.datePicker setHidden:NO];
pickView.title = @"Pay Period";
break;
}
default:
break;
}
Not sure about the exact issue but I think you can try putting your switch case after you push the view controller.
Or use some booleans to pass to the view controller and then in the viewDidAppear of PickerView process your hide / show for the controls
精彩评论