if (cell == nil) {
//cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 260, 44) reuseIdentifier:CellIdentifier] autorelease];
//The line above works like a breeze
cell = [[[UITableViewCell alloc] initWithStyle:initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; //This is the line that is causing me problems
}
这些是错误日志:
/Users/myname/Downloads/myApp/Classes/MyTableView.m: In function '-[MyTableView tableView:cellForRowAtIndexPath:]':
/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: error: 'initWithStyle' undeclared (first use in this function)
/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: error: (Each undeclared identifier is reported only once
/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: error: for each function it appears in.)
/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: error: 'UITableViewCellStyleValue1' undeclared (first use in this function)
/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: warning: no '-initWithStyle::reuseIdentifier:' method found
/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: warning: (Messages without a matching method signature
/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: warning: will be assumed to return 'id' and accept
/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: warning: '...' as arguments.)
答案 0 :(得分:1)
正确的方法是
initWithStyle:reuseIdentifier:
您正在使用
initWithStyle:initWithStyle:reuseIdentifier:
只需删除冗余的initWithStyle:它就可以了。
答案 1 :(得分:1)
你在为OS 3编译吗?我不相信OS 2中存在UITableViewCellStyleValue1
...
答案 2 :(得分:0)
UITableViewCellStyleValue1
。检查您正在使用的SDK。