dejan
dejan

Reputation: 11

cellForRowAtIndexPath not called (again)

I have already found the same question, but answers haven't helped me :( Maybe because I have specific problem. After installing app to iPhone 4S(iOS 5) some problems appear. I already fix couple of them, but this one more stubborn the it seems at first sight.

I opened existing Xcode3 project in Xcode4 and this problem appeared.

I will put some code here:

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    // Return the number of sections.       
     return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.

    return [self.townShopsArray count];
}

I checked: self.townShopsArray is not empty

function:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ...

is not called, so I don't need to put its code here.

Can anyone tell me what could went wrong when I upgraded project from Xcode 3 to Xcode 4?

Upvotes: 1

Views: 354

Answers (1)

Aaron Brager
Aaron Brager

Reputation: 66244

Here are the possible reasons:

  • Your UITableView's data source isn't set to this controller
  • Your UIViewController / UITableViewController's class is not set to the class of this view controller in the Identity Inspector of Interface Builder. If this isn't set, iOS will ask the generic UITableView class for info about your cell, rather than the class you make. Custom Class

  • (If you added the UITableView programmatically)... your pointer to the table isn't strong, and the UITableView has been deallocated

Upvotes: 1

Related Questions