user1256477
user1256477

Reputation: 11201

connecting elements in InterfaceBuilder

I'm having trouble connecting a TableView (I think this is my error, maybe is another one), I have this error:

-[NSObject tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x796aaa0

This is a problem connecting, isn't it?

This is my notice.h:

#import <UIKit/UIKit.h>

@interface Notice : UIViewController <UITableViewDataSource, UITableViewDelegate>
{

UITableView *mainTableView;
NSMutableArray *contentsList;

}


@property (nonatomic, retain) NSMutableArray *contentsList;
@property (nonatomic, retain) IBOutlet UITableView *mainTableView;

@end

in notice.m, I have the usual methods for UITableView implementation.

this is my interface builder:

enter image description here enter image description here enter image description here enter image description here

Thank you in advance

Upvotes: 0

Views: 40

Answers (2)

V-Xtreme
V-Xtreme

Reputation: 7333

First set the Tableview delegate and datasource in the xib. You are getting this error because you have declared the these protocol in .h method but haven't implemented the @required methods of datasource in .m method. Implement two required methods of tableview datasource . This might solve your problem.

Upvotes: 0

Caleb
Caleb

Reputation: 125037

You've connected your table's data source outlet to 'First Responder' when in fact you should connect it to your view controller. They're not the same thing. The First Responder icon is a proxy for the "first responder", i.e. the current first object in the responder chain. It changes depending on the state of your program, and it's not likely to point to your view controller.

Upvotes: 1

Related Questions