The issue that I'm having is that I have My start page, then the user can select a button from there to open a settings page (Modal View). From the settings page the user selects the switch to turn on the PIN code page (another Modal View). I have been killing myself trying to implement this simple process. The app has a Nav&Tab Bar framework. I seem to can not get this right. The code Im using is as follows:
#import "SwitchResponderViewController.h"
@implementation SwitchResponderViewController
- (void)viewDidLoad {
[super viewDidLoad];
[sw addTarget:self action:@selector(switched) forControlEvents:UIControlEventValueChanged];
}
- (void)dealloc {
[secondController release], secondController = nil;
[super dealloc];
}
- (void)switched;
{
if ([sw isOn])
{
NSLog(@"On");
if (!secondController)
secondController = [[SecondViewController alloc] init];
[self presentModalViewController:secondController animated:YES];
}
else
{
NSLog(@"Off");
}
}
@end
I then create an IBOutlet UISwitch called sw in my view controller and hook it up in IB. However I cant get it to compile and work. Any ideas?