【发布时间】:2012-06-29 08:44:41
【问题描述】:
所以我创建了一个函数:
-(void)checkCount:(UITableView *)tableView isIndexPathChecked:(NSIndexPath *)indexPath{
NSString *name = [[NSString alloc] init];
UITableViewCell *investigatedCell = [tableView cellForRowAtIndexPath:indexPath];
if(investigatedCell.accessoryType ==UITableViewCellAccessoryCheckmark)
name = investigatedCell.textLabel.text;
[checkedRows addObject: name];
}
每次我尝试从另一个方法中调用此方法时都会出错。什么是正确的语法?谢谢。
【问题讨论】:
-
知道什么样的错误会很有用。还有你在哪里声明和初始化
checkedRows? -
我不断收到的一个错误是:当我尝试从另一种方法调用它时,使用了未声明的标识符“isIndexPathChecked”。而checkedRows是我在实现中合成的头文件中的一个属性
-
你初始化
checkedRows了吗?否则它只是nil。您是否尝试从下面的方法调用checkCount:isIndexPathChecked:?在这种情况下,您必须在标头或实现中预先声明它。 -
是的,我初始化了checkedRows。并且方法在头文件中声明并在实现文件中定义。另外,如果有区别,方法 checkCount:isIndexPathChecked: 是我文件中的最后一个方法
标签: iphone objective-c function uitableview methods