Question: In IB, the button size and location have been set perfectly well using autoLayout. But when I try to change the button image using the following

```
if (need_Update) {
[_updateButton setImage:[UIImage imageNamed:@"ipad_012_01_update2.png"] forState:UIControlStateNormal];
} 
else {
[_updateButton setImage:[UIImage imageNamed:@"ipad_012_01_update.png"] forState:UIControlStateNormal];
}

```

the button size has been changed. I wonder why would that happen? And how could I fix it?

I mean, for example, the original button image is `iPad_012_01_update.png`, and it displays perfectly. When the `need_Update` value is `YES`, and the button image is changed to `ipad_012_01_update2.png`, but the button size is also changed.

Thanks in advance!

Summary
-------

Using `Background Image` is a very good way to prevent unwanted size changing!

Also, there's a lesson: If you do want to use `button image` instead of `button background image`, be sure that the two button images are of the same resolution! This will reduce the chance that the image is resized itself.

Answer: 
The background image is scaled to fill the bounds of the UIButton, and is displayed behind the title. The foreground image is not scaled, and displayed next to the button title. So try to set the backgroundImage of a button.

[UIButton image and background image, which one to use for custom image?](https://stackoverflow.com/questions/1309977/uibutton-image-and-background-image-which-one-to-use-for-custom-image)
From the looks of it, it seems like your image is extending beyond the bounds of the button, so to you it looks like the button size is changing.

To test this, try setting the clipsToBounds to YES for the button.

It will clip anything that is going beyond the bounds of button.

So you will be able to analyze it in a better way and decide accordingly about how you want to move forward.