Iphone 已将无法识别的选择器发送到实例uitableview
我收到错误:无法识别的选择器被发送到实例,经过检查,我发现这段代码中存在问题,更具体地说:Iphone 已将无法识别的选择器发送到实例uitableview,iphone,Iphone,我收到错误:无法识别的选择器被发送到实例,经过检查,我发现这段代码中存在问题,更具体地说:[self.tableView insertSubview:ovController.view oversubview:self.parentview controller.view] - (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar { if(searching) return; //Add the overl
[self.tableView insertSubview:ovController.view oversubview:self.parentview controller.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;
}
tableview似乎有问题?我不确定为什么这会导致无法识别的选择器异常,但很可能[self.tableview insertSubview:ovController.view oversubview:self.parentview controller.view];可能是对的。仅当self.parentViewController.view是self.tableView的子视图时,此操作才有效。除非你对视图层次结构做了非常有害的事情,否则这看起来像是自上而下的。你确定你要使用self.parentViewController.view
而不是[self.view superview]
?早上这个时候我很累-。-,修正了self.viewsuperview:)谢谢,让我们模拟一下:菜单(根控制器)->项(二级控制器)。现在你这么说,这是有道理的。