小编mhm*_*hsh的帖子

textField在UITableView中出现两次

我有我的ageTextField财产TableViewController.我将它添加到第一部分单元格的子视图但我不知道为什么它在另一部分(#3)中向下滚动时显示...

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    }
    // Configure the cell...
    switch (indexPath.section){
        case 0:
        {
            [cell addSubview:self.ageTextField];
        }
        break;
        case 1:
        {
            cell.textLabel.text = [screeningArray objectAtIndex:indexPath.row];
            if (indexPath.row == 0)     //no choice
                cell.accessoryType = self.doneScreening ? UITableViewCellAccessoryNone:UITableViewCellAccessoryCheckmark;
            else                        //yes choice
                cell.accessoryType = self.doneScreening ? UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
        }
        break;
        case 2:
        {
            cell.textLabel.text = …
Run Code Online (Sandbox Code Playgroud)

uitableview uitextfield

3
推荐指数
1
解决办法
1120
查看次数

野牛错误恢复

我发现我可以在语法规则中使用'error'作为错误恢复的机制.因此,如果出现错误,解析器必须丢弃当前行并从下一行继续解析.来自野牛手册的一个例子可能是这样的:

stmts:
      exp
      |stmts exp
      | error '\n'
Run Code Online (Sandbox Code Playgroud)

但我不能用它; 因为我必须在我的scannar中使flex忽略'\n',所以表达式不限于在一行中表示.我怎样才能使解析器 - 遇到错误时 - 继续解析到下一行,假设没有特殊字符(即分号)来表示表达式的结尾并且没有'换行符'令牌?

谢谢..

parsing newline bison error-recovery

3
推荐指数
1
解决办法
2402
查看次数