views:

111

answers:

1

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?

A: 

Let me get this straight. You're using a UISwitch to go to a new view when it's toggled? Maybe that's not what's going on, but it looks like it to me, and that's a bad way to do things.

Also, you've got an extra semicolon after -(void)switched

Ed Marty
you are correct. any suggestions?
SympleMyne
bump for the Monday morning crew for help on this.
SympleMyne
my suggestion would be to replace the switch with a button and get rid of the semicolon
Ed Marty