Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

atlsharif

macrumors newbie
Original poster
Jun 10, 2008
2
0
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:

Code:
#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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.