title: iphone setting and reading state UISwitch
body: <p>I have a view in which its objects are set from a database and likewise saved to a database. The UITextViews are working great, but I cannot seem to find out how to set the state of a UISwitch.  </p>
  
  <p>I can change it in the IB but that isnt what I need.  The record in the DB has a 0 or 1 boolean.  So if the field is true then I want to set the state of the UISwitch to ON.</p>
  
  <p>Also when I save the record, I need to be able to look at the value on the view, and thus set the field on my table.</p>
  
  <p>thanks for any help!!</p>
  
  <p><strong>EDIT:  This is what I have done so far:</strong></p>
  
  <p><em><strong>.h  file</em></strong></p>
  
  <pre><code>@interface UserEdit : UIViewController {
  
  
      IBOutlet UISwitch *male;
  
  }
  
  
  @property (nonatomic, retain) IBOutlet UISwitch *male;
  </code></pre>
  
  <p><em><strong>.m file</em></strong></p>
  
  <pre><code>@synthesize male;
  
  
  - (void)viewDidLoad {
      [super viewDidLoad];
  
      [male SetOn:NO];
  
  
  }
  </code></pre>
  
  <p>the app dumps when it hits the SetOn line above</p>
  
  <p>I also need to be able not only set the value, but read it too</p>