if u want to choose only one selected of twos using following line of code......
IBOutlet UIButton *btnCheckBox1;
IBOutlet UIButton *btnCheckBox2;
btnCheckBox1.tag = 1;
btnCheckBox2.tag = 2;
[btnCheckBox1 setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
[btnCheckBox2 setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
-(IBAction)btnCheckboxClicked:(id)sender{
UIButton *selectedButton = (UIButton *)sender;
UIButton *toggledButton;
if (selectedButton.tag == 1 ) {
toggledButton = btnCheckBox1;
[btnCheckBox1 setImage:[UIImage imageNamed:@"active-checkbox.png"] forState:UIControlStateNormal];
strType = lblEmployee.text;
}
else {
[btnCheckBox1 setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
}
if (selectedButton.tag == 2 ) {
toggledButton = btnCheckBox2;
[btnCheckBox2 setImage:[UIImage imageNamed:@"active-checkbox.png"] forState:UIControlStateNormal];
strType = lblEmployers.text;
}
else {
[btnCheckBox2 setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
}
[toggledButton setSelected:NO];
[sender setSelected:YES];
}
IBOutlet UIButton *btnCheckBox1;
IBOutlet UIButton *btnCheckBox2;
btnCheckBox1.tag = 1;
btnCheckBox2.tag = 2;
[btnCheckBox1 setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
[btnCheckBox2 setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
-(IBAction)btnCheckboxClicked:(id)sender{
UIButton *selectedButton = (UIButton *)sender;
UIButton *toggledButton;
if (selectedButton.tag == 1 ) {
toggledButton = btnCheckBox1;
[btnCheckBox1 setImage:[UIImage imageNamed:@"active-checkbox.png"] forState:UIControlStateNormal];
strType = lblEmployee.text;
}
else {
[btnCheckBox1 setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
}
if (selectedButton.tag == 2 ) {
toggledButton = btnCheckBox2;
[btnCheckBox2 setImage:[UIImage imageNamed:@"active-checkbox.png"] forState:UIControlStateNormal];
strType = lblEmployers.text;
}
else {
[btnCheckBox2 setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];
}
[toggledButton setSelected:NO];
[sender setSelected:YES];
}
wow that post is nice and if u have some code then please share with me i m waiting for yours the next post
ReplyDeletethanks
-----------------------------------------------------------------
iPhone 5 App Development And
iPad Application Developer
-------------------------------------------------------------------------------