的财产我有我想设置为一个按钮的属性一个布尔值:根据发件人的标签使用BOOL作为按钮
int tag = (int)[sender tag];
NSString* keyPath = [NSString stringWithFormat:@"addButton%d.hidden", tag];
[self setValue:YES forKey:keyPath];
我不能直接这样做,因为Add按钮的数量变化。
我已经试过:
setValue:[NSNumber numberWithBool:YES]
,但不起作用。
我在哪里错了?
谢谢,工作!只有一件事:我使用[addButtons [[sender tag]] ...]使其工作,否则它给了我一个错误。 –
@MatteoLaMendola它取决于你的按钮是以“0”还是“1”开始。 – Sulthan