开发者

Change UIViewController to a UITableViewController?

开发者 https://www.devze.com 2023-02-23 01:10 出处:网络
I have a UITableView that i want to reload the data from. I know how to do that, but when calling it from [self.tableView reloadData], I get errors with my current UIViewController configuration like

I have a UITableView that i want to reload the data from. I know how to do that, but when calling it from [self.tableView reloadData], I get errors with my current UIViewController configuration like this:

@interface processViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {

So my thought would be to change the开发者_如何学Python UIViewController to a UITableViewController like this:

@interface processViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {

// or this:

@interface processViewController : UITableViewController {

However, when trying to load the view i get this error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "processView" nib but didn't get a UITableView.'

When in interface builder, there is no tableView connection there (but there are delegate and dataSource).

What am I doing wrong?

Thanks,

Coulton


It sounds as though you need to set the identity (in other words the class) of the controller instance in Interface Builder to your custom subclass.

By the way, the tableView property of UITableView isn't ever exposed in IB, because it's essentially a synonym for the view property -- the two properties both refer to the same instance variable, _view. The tableView property simply is more strongly typed.

Just a side note: by convention, Objective-C class names should begin with a capital letter, i.e., ProcessViewController, not processViewController.

0

精彩评论

暂无评论...
验证码 换一张
取 消