andrewz
andrewz

Reputation: 5220

How to set selected image of UIButton in XCode Interface Builder

I have two image sets for "flag" button in my Images.xcassets: flag-highlighted and flag-normal, where each set has 3 images of size x1, x2, x3

I use the flag-normal image set for the Image attribute in the attributes inspector for this button. But, where/how do I specify the flag-highlighted image set for the selected state?

Upvotes: 7

Views: 4305

Answers (2)

Gulfam Khan
Gulfam Khan

Reputation: 1089

If anyone is wondering why the state config is missing for button in xcode 13, you need to change button's style from plain to default after that state config drop down will appear and you can change it to whatever you want

enter image description here

Upvotes: 20

seto nugroho
seto nugroho

Reputation: 1379

You can set image for specific button state via interface builder by using state config option.

State config option

Choose selected option and then pick your image for selected state.

Upvotes: 23

Related Questions