Hi friends,
I have created scroll view and sets the buttons are in the scroll view. The Buttons are scrolling horizontally and it works fine. If i clicked the button, i set background image as "Selected State" in button. My problem is how can i changed the selected state in different button, when clicking it and how can i deselected the "selected state" button when clicking the another button.
I have three buttons in the scroll view,
-(IBAction) Button1 : (id) sender
{
// btn1.selected = YES;
[btn1 setImage:[UIImage imageNamed:@"first.png"] forState:UIControlStateSelected];
}
-(IBAction) Button2 : (id) sender
{
// btn2.selected = YES;
[btn2 setImage:[UIImage imageNamed:@"second.png"] forState:UIControlStateSelected];
}
-(IBAction) Button3 : (id) sender
{
// btn3.selected = YES;
[btn3 setImage:[UIImage imageNamed:@"three.png"] forState:UIControlStateSelected];
}
see the below image,(Health, Entertainment and Money Watch are the three buttons)
and
Note:(Like, Tabbar and Segmented control)
On clicking first button and sets background image in selected state and clicking the second button, then first buttons are to be deselected. So how can i maintain the selected state, till another button is clicked.
Thanks in Advance.