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?

Enquirer: dejan

||

Solution #1:

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

Respondent: Aaron Brager

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.