在这里我的应用程序有一组按钮 12 按钮,按钮标题默认隐藏。按钮标题在单击时显示,
-(IBAction)buttonAction:(id)sender
{
UIButton *button = (UIButton *)sender;
int index = button.tag;
[self showing:index]; //now, this method accepts a parameter.
}
-(void)showing:(NSInteger)index
{
UIButton* btn = nil;
index = index - 1;
NSArray* subViewArray = [self.view subviews];
NSInteger i = 0;
for (UIView *view in subViewArray)
{
if ([view isKindOfClass:[UIButton class]])
{
btn = (UIButton*) view;
if(btn.tag >= 1 && btn.tag <= 16)
{
NSString* text;
UIButton *prevButton = (UIButton*) [self.view viewWithTag:previousButtonTag];
if (i == index) {
if ([btn.titleLabel.text isEqualToString:prevButton.titleLabel.text])
{
}
else
{
text=@"";
}
text = [texts objectAtIndex:i]; //put the array that you are using
}
else {
text = @"";
}
i++;
[btn setTitle:text forState:UIControlStateNormal];
}
}// end of IF
} //end of FOR
}
1.我想比较两个按钮标题值来检查它是否相等。我面临这个问题,
2.仅按按钮标题可见,当我单击其他按钮时,上一个标题被隐藏,我想在单击时启用两个按钮标题,但错误应该隐藏。请建议我如何解决此问题,请执行必要的