Search code examples
iphoneiosobjective-cios6

Pasted code couldn't work in a new project ?


Today, I copied a function codes in an old project to paste in a new project, the following is the related codes

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

When I debug the project, it's never been called.Then related codes and storyboard is checked, nothing wrong, so I deleted the pasted functions codes, and wrote the codes word by word; debug, run and it's been called.

The other pasted codes were well run and called. Only this function had an issue.

After all, I studied the issue, and cannot find why it happened.

Please, help me to solve "the paste codes cannot be called".

Thanks a lot.


Solution

  • You have a capitalization issue in the method name. change tableview: into tableView:

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

    should be this

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