View Full Version : Can anyone help me understand this objective-c code?
Glama
Feb 5, 2009, 01:19 PM
UISwitch *whichSwitch = (UISwitch *) sender;
BOOL setting = whichSwitch.isOn;
[leftswitch setOn:setting animated:YES];
[rightswitch SetOn:setting animating:YES];
The last two lines especially leave me clueless.
lee1210
Feb 5, 2009, 01:25 PM
It looks like whatever class leftswitch and rightswitch belong to has a method called setOn:animating: that takes two BOOL values. In this case it's passing the value of setting, which will be YES or NO for setOn, and YES for animating.
-Lee
Glama
Feb 5, 2009, 01:50 PM
I get it now. :-)
ray648
Feb 5, 2009, 06:26 PM
Objective C is case sensitive so setOn and SetOn are different. In this code it looks like its probably a typo, but watch out for this.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.