I am changing the UIButton image on button click but it gets postion changes from original to left side. I don’t know why this is happening.
Below is the button. When I select the second button, it changes image and gets to the left side. How do I fix this error ?
Below is my code
-(IBAction)locationOneButtonAction{
UIImage *buttonImage = [UIImage imageNamed:@"radiogreen.png"];
UIImage *buttonImageOne=[UIImage imageNamed:@"radiowhite.png"];
[locationOneButton setImage:buttonImage forState:UIControlStateNormal];
[locationOneButton setImage:buttonImage forState:UIControlStateNormal];
[locationThreeButton setImage:buttonImageOne forState:UIControlStateNormal];
[locationTwoButton setImage:buttonImageOne forState:UIControlStateNormal];
[locationFourButton setImage:buttonImageOne forState:UIControlStateNormal];
[locationFiveButton setImage:buttonImageOne forState:UIControlStateNormal];
[locationSixButton setImage:buttonImageOne forState:UIControlStateNormal];
resturantLocation=@"Common Man - Bedford, MA";
}
I am not hundred percent sure about your case but it usually happen because of transparent space in both images, please overlap your images in Photoshop and make sure both images should have same margins and also should be of same size.