0
我收到一条警告,提示initWithFrame:reuseldentifer:
已被弃用。我不知道这是什么意思。我如何解决这个错误免费?UITableViewCell - initWithFrame:reuseldentifer:已弃用
// If no cell is available, create a new one using the given identifier
if (cell == nil) {
cell = [[[ThreadSCell alloc] initWithFrame:CGRectMake(0,0,0,0) reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
}
我正在使用this code。
由于框架参数总是被忽略(宽度等于表视图的宽度,高度由委托设置,原点由表视图自身计算),因此不推荐使用的方法非常糟糕。他们只是弃用了API,因为它没有任何意义。 – Costique 2012-03-16 05:26:56
如果您更改为... cell = [[[ThreadSCell alloc] initWithStyle:CGRectMake(0,0,0,0)reuseIdentifier:CellIdentifier] autorelease];出现错误。 – user1273250 2012-03-16 05:29:07
@ user1273250当然,因为style参数不是CGRect。您应该在UITableViewCell头或类引用中查找该方法以了解如何使用它。 – EmilioPelaez 2012-03-16 05:42:35