7

Edit: Here is the screenshot:

screenshot

The button on the right is selected. I'd like the color to fill the entire button.

The buttons are created on storyboard with widths pinned. I simply toggle selected/not selected with

button.selected = YES;

I have not found any similar questions about adjusting the width of the part that is selected, and I haven't been able to figure out any solutions. Any ideas?

1 Answers1

3

Make sure your UIButton's type is "Custom", not "System".

Custom button type

rebello95
  • 8,486
  • 5
  • 44
  • 65
  • 2
    I did have it on system, but with "custom" it doesn't become selected at all, and also doesn't change tintcolor like my other buttons, the text color is white unless I change button.titleLabel.textColor, and then when it is pressed, the textColor changes itself to white and doesn't change back..? But the background doesn't switch colors when highlighted like it did when I was using "System" button. Is the best way to manually change the title color and background color of buttons every time the user clicks? – HelloThisIsMyName Aug 02 '14 at 20:32
  • Hmm, I've never had that issue. This may help: [link](http://stackoverflow.com/questions/20300766/how-to-change-the-highlighted-color-of-a-uibutton) – rebello95 Aug 02 '14 at 20:42
  • Hmmm.. not sure how exactly I'm going to accomplish this but now I have more ideas, so thank you! – HelloThisIsMyName Aug 02 '14 at 20:44