UIViewController in UITableView object does not respond, need to be solved
Doing a project on the 13th would pay, but there is a problem solving can not understand total ~ UITableView object does not respond to the problem of
I dish a b, just learning OC week so I do not know how it happened, but now need to pay a usable work, seeking much they lend a helping hand in this ......
So, there is a page in the Storyboard is UIViewController'sThen there are a TableView table, because there are other controls, so there is no use UITableViewController.
I set the Custom Class became my own definition of a class (FirstViewController), that class is inherited from UIViewController's
Then inside the TableView with Storyboard control + mouse connected to the FirstViewController.h inside, named tableView
Then, in order to be able to write in FirstViewController.m - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection such a function, I inherited from behind in FirstViewController.h UIViewController added in agreement , is this:
@ interface FirstViewController: UIViewController
Meanwhile, I was in the Storyboard where the TableView is associated DataSource and Delegate to the top of the FirstViewController
Then I wrote in FirstViewController.m in the - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section and - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath implementation, inside the statement is very simple
Then run time error will An exception is thrown, said UITableViewController didView, but did not find UITableView object I do not know how it is, I really went TableView in Storyboard dragged inside the control, but also an object FirstViewController association, set up two protocal, the. M file write those to achieve, but do not know why it will There are exceptions.
Today on the Internet looking for a day, someone said to define a LoadView display function, which is written on the [super LoadView] on it, but I tried, no. And that is abnormal in super LoadView when thrown Implore you to help me look in the end is how is it
Dormitory tonight, tomorrow morning you can screenshot Reply:
Top Reply: UITableView delete the controls, declare the property in a UITableView. H file, the same statement that both DataSource and Delegate of the agreement,. M files plus you said that several response function to try Reply:
Sure enough, can be used, although I do not know why, but at least can show things, 3q ~
No comments:
Post a Comment