在我的应用程序中,我想基于IBActions加载我的单元格。这是我的两个IBActions,
-(IBAction)action1:(id)sender
{
}
-(IBAction)action2:(id)sender
{
}
我想像这样加载
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (value == 0)
{
return 96;
}
else if(value == 1)
{
return 237;
}
return 0;
}
如何将我的值= 0分配给我的action1,将值= 1分配给我的action2?
答案 0 :(得分:3)
-(IBAction)action1:(id)sender
{
self.value = 0
self.tableView.reloadData()
}
答案 1 :(得分:1)
写下面的代码
-(IBAction)action1:(id)sender
{ self.value = 0
self.tableView.reloadData()
}
-(IBAction)action2:(id)sender
{
self.value = 1
self.tableView.reloadData()
}
答案 2 :(得分:0)
无需创建两个方法即可使用UIButton类的标记属性
-(IBAction)action1:(UIButton *)sender
{
if (sender.tag == 0)
{
self.value = 0;
}
else
{
self.value = 1;
}
self.tableView.reloadData()
}