viewForHeaderInSection方法代码错误的按钮

时间:2014-01-22 17:30:57

标签: ios

在我的代码中,viewForHeaderInSection方法有一个按钮。按钮操作如下:

[bt addTarget:self action:@selector(addCell:) forControlEvents:UIControlEventTouchUpInside];

从该按钮启动的方法如下:

- (void)addCell:(UIButton *)bt{

    // If section of more information
    if(bt.tag == 2) {

        // Initially more info is close, if more info is open
        if(ifOpen) { //**error here (use of undeclared identifier fOpen)
            DLog(@"close More info");

            // Set height of section
            heightOfSection = 0.0f; //**error here (use of undeclared identifier heightOfSection)

            // Reset the parameter that more info is closed now
            ifOpen = NO;//**error here (use of undeclared identifier fOpen)
        }else {
            // Set height of section
            heightOfSection = 45.0f;//**error here (use of undeclared identifier heightOfSection)
            // Reset the parameter that more info is closed now
            DLog(@"open more info again");
            ifOpen = YES;//**error here (use of undeclared identifier fOpen)
        }
        //[self.tableView reloadData];
        [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:2] withRowAnimation:UITableViewRowAnimationFade];
    }

}// end addCell

我在这里标有// **错误的行收到错误警告。 恳请您帮我清理这段代码。谢谢。

1 个答案:

答案 0 :(得分:0)

ifOpen在任何地方宣布?如果不是,当它抱怨ifOpen没有被声明时编译是正确的。