I would like to display one image on top of another image. Basically i am trying to show the box is checked. The problem is that when click the unchecked image, the check button appears but the checkbox goes off.. I would like the check symbol to appear on top of the checkbox.
The code looks like this:
if (ShopCartUnedited) {
[button setBackgroundImage:[UIImage imageNamed:@"none.png"] forState:UIControlStateNormal];
[arrOfObjects addObject:@"NO"];
}
else {
if (counter+1 <= nQty) {
[button setBackgroundImage:[UIImage imageNamed:@"check2.png"] forState:UIControlStateNormal];
[arrOfObjects addObject:@"YES"];
}
else {
[button setBackgroundImage:[UIImage imageNamed:@"none.png"] forState:UIControlStateNormal];
[arrOfObjects addObject:@"NO"];
}
}
How do i change such the check2.png is on top of none.png when if it clicked…
Either you can have two different images, one with check mark and other without checkmark and switch between them. If that is not possible, you need to add a separate imageview on top of button for
check2.pngor instead of this if-else block, just use