bear
bear

Reputation: 11605

Unrecognised selector sent to instance uitableview

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?

Upvotes: 0

Views: 349

Answers (1)

cduhn
cduhn

Reputation: 17918

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.

Upvotes: 2

Related Questions