Search code examples
checkboxnsbutton

Setting default checkbox value in Objective-C?


Okay, this one's making me feel stupid...

I'm a feature film editor who's recently started teaching myself Objective-C after many years away from coding. I think the last code I wrote was in Cobol, if that gives you any indication.

Anyway, I've recently written a small utility to take an edit decision list from Avid Media Composer and parse it for user-specified markers to automatically generate a sub-caption file. It's useful, it saves me a great amount of time, and it works.

I built my GUI in interface builder.

Now I'm interested in adding a small bit of functionality to my app, and I'd like to simply use a checkbox to ask the user if they'd like to use this functionality, ie: if it's checked, then do this.

I can add a checkbox using interface builder and I can check the status of it. My stupid noob question is: how do I set the checkbox to default to "Off" instead of "On" as interface builder seems to do automatically?

Thanks in advance for any quidance on this.

Chris Conlee


Solution

  • Documentation on UISwitch says:

    [mySwitch setOn:NO];
    

    In Interface Builder, select your switch and in the Attributes inspector you'll find State which can be set to on or off.