How to compare 2 button title using index or tag value
- by fasil moham
Here my application i having set of button 12 buttons,button titles are hidden by default.Button titles are shown when it is clikced ,
-(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;
NSString* text;
if (i == index) {
text = [self.textArray objectAtIndex:i]; //put the array that you are using
self.previousButtonTag = i; //make a class variable
}else {
text = @"";
}
i++;
[btn setTitle:text forState:UIControlStateNormal];
}
}
}
1.I want to compare two button title values to check whether it is equal or not.Im facing the problem ,
2.Only press button title only visible,when i click other button previous title is hided,I want to enable two button title on click and wen it is wrong it should be hided.Please suggest me the How to solve this issue,Please do the needfully