views:

289

answers:

1

Hi. I have a problem with my XCode project. (I am a noob at Objective-C and XCode, so please be patient with me..)

I created a new project as a Tab Bar application.

I created four new header, implementation and interface files, and added those as the sources in interface builder. They were in this format: FirstView.h/m/xib, SecondView.h/m/xib.

I then had files for First-, Second-, Third- and FourthView. There was also a file there called FirstViewController. I did not touch this, I just deleted it because I wasn't going to need it.

I then laid out my interface for the first view (FirstView.h/m/xib) in IB. It had an image on the top, label under and a UITableView under that.

I sat up the correct connections (delegations and datasource for the tableview) in my FirstView.h/m file, and pressed Build. It seemed to build without errors, so I pressed Build and Go.

The Simulator popped up, installed the app and crashed. (Error message:Terminating app due to uncaught exception).

Complete error message:

2010-02-06 21:50:54.733 Mudo[52439:207] *** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0
2010-02-06 21:50:54.735 Mudo[52439:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0'
2010-02-06 21:50:54.736 Mudo[52439:207] Stack: (**LotsOfNumbers**)

I asked about this in another question, got an answer, and that fixed it:

It was obviously looking for code in the FirstViewController.h/m-file, although I did not do anything to make it look for code there.

I fixed this by adding two interfaces and implementations in my FirstView.h/m file. (FirstView and FirstViewController)

When I ran the app then, the table view and tab bar came up on the screen, but my image and label did NOT. I don't have any idea of why it was looking for the code in FirstViewController instead of FirstView... I have the correct connections in IB, too..

Please help me? Thank you..

+1  A: 

A tableview is trying to query its data source for the number of rows it should display. If you've connected the tableview's datasource outlet to an instance of your FirstViewController class, then you need to implement -tableView:numberOfRowsInSection: in that class.

NSResponder