i have created a button on main.storyboard and i can add IBAction too. But, my aim is to make a sticky button(after you clicked once it is stayed pressed until you click it again) can somebody suggest please.
Asked
Active
Viewed 120 times
0
-
1set color or image in selected state of UIbutton – Anbu.Karthik Oct 14 '15 at 10:14
-
@Anbu.Karthik Hi, sorry i don't get it. should i do this by adding IBAction? – wes. i Oct 14 '15 at 10:16
-
ya , correct, see this link http://stackoverflow.com/questions/14523348/how-to-change-the-background-color-of-a-uibutton-while-its-highlighted – Anbu.Karthik Oct 14 '15 at 10:23
-
2Possible duplicate of [iPhone UIButton with UISwitch functionality](http://stackoverflow.com/questions/2255166/iphone-uibutton-with-uiswitch-functionality) – Matt Le Fleur Oct 14 '15 at 10:31
-
@Anbu.Karthik Yea, i think it is what i'm looking for, but it is in objective-c, can translate into swift? – wes. i Oct 14 '15 at 10:58
-
see this link may be helps you http://stackoverflow.com/questions/24030348/how-to-create-a-button-programmatically – Anbu.Karthik Oct 14 '15 at 11:06
1 Answers
1
Set Image in selected state of uiButton, means you need two image one for unselected and another for selected

Kratos
- 64
- 6
-
yup, problem solved by changing the background colour! Thanks by the way =) – wes. i Oct 15 '15 at 06:18