ios - XCode Create a Button Toggle that shows one image for On and one for Off with function -


i trying create toggle button in xcode on , off switch toggling incoming text messages. when feature on image designed on. need set image property state button on. when image off. button has image says off.

what best route complete code.

ryan

i use:

//create switch  uiswitch *myswitchbutton; myswitchbutton.frame=cgrectmake(10, 10, 40, 50); [self addsubview:myswitchbutton]; 

then, add images

myswitchbutton.offimage=[uiimage imagenamed:@"off.png"]; myswitchbutton.onimage=[uiimage imagenamed:@"on.png"]; 

where off.png , on.png images custom design


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -