UITableView没有正确绑定导致unrec…

来源:互联网 发布:java可以自学吗 编辑:程序博客网 时间:2024/05/16 12:02

错误1:[UIView tableView:numberOfRowsInSection:]: unrecognizedselector sent to instance 0x45fad0


错误2:setValue:forUndefinedKey:]: this class is not key valuecoding-compliant for the key tableView.'

 

What that is saying is that someone sent the‘tableView:numberOfRowsInSection:’ method to a UIView. And theUIView class does not recognize that method. My guess is that thedatasource for your tableView is connected to the view instead ofthe files owner.


查看xib的File's Owner点击弹出的框显示 ui之间的关系才比较清楚。


找到的原因是:self.viewController= [[CJQViewControlleralloc] initWithNibName:@"CJQ2ViewController"bundle:nil];

CJQ2ViewController.xib没有用CJQ2ViewController来初始化,并且CJQViewController里面没有实现tableView的相关方法。

0 0
原创粉丝点击