tags:

views:

50

answers:

1

I'm getting error: Unrecognised selector sent to instance, upon inspection, I see there is an issue in this section of code, and more specifically: [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view];

- (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar {


 if(searching)
  return;

 //Add the overlay view.
  ovController = [[OverlayViewController alloc] initWithNibName:@"OverlayView" bundle:[NSBundle mainBundle]];

  CGFloat yaxis = self.navigationController.navigationBar.frame.size.height;
  CGFloat width = self.view.frame.size.width;
  CGFloat height = self.view.frame.size.height;

  //Parameters x = origion on x-axis, y = origon on y-axis.
  CGRect frame = CGRectMake(0, yaxis, width, height);
  ovController.view.frame = frame; 
  ovController.view.backgroundColor = [UIColor grayColor];
  ovController.view.alpha = 0.5;

  ovController.rvController = self;

  [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view];

 searching = YES;
 letUserSelectRow = NO;
 //self.tableView.scrollEnabled = NO;

 }

Looks like there's an issue with tableview?

+2  A: 

I'm not sure why this would result in an unrecognized selector exception but it seems highly unlikely that [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view]; could possibly be correct. This would only work if self.parentViewController.view is a subview of self.tableView. That seems inside-out unless you're doing very abusive things to your view hierarchy.

cduhn
@cduhn I agree. +1
Jacob Relkin
ok, let's model this: menu (root controller) -> items (secondary controller). Now you've put it that way, it makes sense.
Shamil