Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 为什么我会得到一个“a”;冲突类型“;警告下面的实例方法?_Iphone - Fatal编程技术网

Iphone 为什么我会得到一个“a”;冲突类型“;警告下面的实例方法?

Iphone 为什么我会得到一个“a”;冲突类型“;警告下面的实例方法?,iphone,Iphone,我有下面的代码 - (UITableViewCell *)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { [[cell textLabel] setFont:[UIFont systemFontOfSize:10.0]]; return cell; } 由于某些原因,我得到以下错误: 警告:'-(UI

我有下面的代码

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

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

return cell;
}
由于某些原因,我得到以下错误:

警告:'-(UITableViewCell*)tableView:(UITableView*)tableView将显示cell:(UITableViewCell*)RowatineXpath的单元格:(NSIndexPath*)indexPath'的类型冲突

有人知道这是什么原因吗

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

根据苹果公司的说法,我想应该是无效的。

你使用了错误的方法。使用

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

而不是你的。这样就不会显示警告了。;-)

该方法的返回类型应为
void
。该方法不返回单元格,而是simpoly通知您将显示该单元格。显示的特定单元格作为方法参数之一传递。你不需要退货。您可以设置字体,然后让它继续进行。

-1因为没有考虑CellForRowatineXpath不是该询问者想要的方法。不幸的是,这不能解决我的问题。无法修改cellForRowAtIndexPath中的字体。查看此线程以了解更多信息:谢谢,此线程已修复它。愚蠢的我。:)