tags:

views:

175

answers:

2

The iphone program is set up in the Utility Application model where you have a root view and two subviews (mainViewController & flipsideViewController) which are outlets.

If I try to set the UISwitch at rootViewController's viewDidLoad (with [flipsideViewController.switchInstance setOn:YES]), it doesn't work.

Within flipsideViewController, that method works but not outside of it. Any idea why? I can pass other methods...

Even if I pass a method to the flipsideViewController that then does the setOn method, it still doesn't work...

Any ideas?

A: 

Just as a 'sanity-check' (as others have put it to me) have you made sure your flipsideViewController variable is not null at the time you are calling the above code?

Dutchie432
A: 

This is correct Dutchie!

The next morning, I realized that flipsideViewController isn't loaded when the program loads so the method to set the switch is going nowhere. I instead set the switch right after the view loaded. Works like a charm!

Thanks for you help.

Jacob
It's not often I answer questions on this topic as I am very new to iPhone development, so I am happy to help. Luckily, I have extensive experience is "silly" over-looked mistakes. :) Happy coding.
Dutchie432