Search code examples
iosuitableviewios6

ios - syntax errors on cellForRowAtIndexPath for UITableView


I have this declaration for cellForRowAtIndexPath but I get a syntax error:

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

}

and this is the error:

"use of undeclared identifier tableView"

But in my other controllers where I have the same sort of a setup, I don't get that error. Would anyone know why this error happens and how to fix it?

This is the screen shot:

enter image description here


Solution

  • The problem is that you have tried to declare a method inside a method. The compiler has reported this in a confused way.