Iphone initWithFrame-尝试与initWithStyle交换-发生错误
我有一段使用旧折旧方法的代码Iphone initWithFrame-尝试与initWithStyle交换-发生错误,iphone,objective-c,ios,xcode,Iphone,Objective C,Ios,Xcode,我有一段使用旧折旧方法的代码 cell1 = [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:kLastCellIdentifier] autorelease]; 我尝试简单地将initWithFrame部分替换为initWithStyle cell1 = [[[CustomCell alloc] initWithStyle:CGRectZero reuseIdentifier:kLastCellIdentifier]
cell1 = [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:kLastCellIdentifier] autorelease];
我尝试简单地将initWithFrame部分替换为initWithStyle
cell1 = [[[CustomCell alloc] initWithStyle:CGRectZero reuseIdentifier:kLastCellIdentifier] autorelease];
然而,这不起作用,并给出了一个新的错误
“从'const CGRect'到'UITableViewCellStyle'aka'int'没有可行的转换”
我想知道是否有人可以帮我更换代码行,使其适合新的操作系统而不会出错
亲切问候,
Chris对于ios6,您传递的不是矩形,而是样式 样式不是rect,而是uitableviewcellstyle枚举值
typedef enum {
UITableViewCellStyleDefault,
UITableViewCellStyleValue1,
UITableViewCellStyleValue2,
UITableViewCellStyleSubtitle
} UITableViewCellStyle;
使用默认值
UITableViewCellStyleDefault
非常感谢:)