Search code examples
iosuiswitch

Switches in ios


I am a mere beginner in iOS. I have seen this statement ** [leftSwitch setOn:setting animated:YES];** in a tutorial describing about switches.

    UISwitch *leftSwitch;


    UISwitch *whichSwitch = (UISwitch *)sender;
    BOOL setting = whichSwitch.isOn;
   [leftSwitch setOn:setting animated:YES];

Please explain me the need of keyword animated in this context.Thanks in advance


Solution

  • in objC, parameters dont come behind the method name like in C or java or ... in objC, parameters are interwoven with the method name..

    lalalaa:PARAM lalala:PARAM2 lalala:PARAM3
    

    after every : comes a ONE param

    so animated: = part of method name

    setOn:animated: