tags:

views:

36

answers:

3

I have the below code

- (UITableViewCell *)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {

[[cell textLabel] setFont:[UIFont systemFontOfSize:10.0]];

return cell;
}

For some reason, I'm getting the following error:

warning: conflicting types for '-(UITableViewCell *)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath'

Does anyone have any idea what might be causing this?

+3  A: 
- (void)tableView:(UITableView *)tableView
     willDisplayCell:(UITableViewCell *)cell
         forRowAtIndexPath:(NSIndexPath *)indexPath

I guess it should be void according to Apple.

Michael
Thanks, this fixed it. Silly me. :)
sluther
A: 

You use the wrong method. Use

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

instead of yours. Than it won't show that warning. ;-)

Sandro Meier
-1 for not taking into account that cellForRowAtIndexPath isn't the method this asker wants.
Jasarien
But it would solve his Problem. ;-)
Sandro Meier
Unfortunately, no this wouldn't solve my problem. You can't modify the font in cellForRowAtIndexPath.See this thread for more information: http://stackoverflow.com/questions/1895425/uitableviewcell-font-not-changing
sluther
+2  A: 

The return type for that method should be void. The method doesn't return a cell, it simpoly informs you that it is going to be displayed. The particular cell being displayed is passed as one of the methods parameters. You don't need to return it. You can just set the font, and let it carry on.

Jasarien