- (void)viewDidLoad
{
[super viewDidLoad];
if ([[self.settings objectForKey:@"mem"]boolValue])
self->mySwitch.on = YES;
else
self->mySwitch.on = NO;
[mySwitch addTarget:self action:@selector(changeSwitch:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:mySwitch];
}
- (void)changeSwitch:(id)sender{
if([sender isOn]){
NSLog(@"Switch is ON");
} else{
NSLog(@"Switch is OFF");
}
}
I'm getting the changes in mySwitch when I click it but it does not calls the changeSwitch: method automatically when the value changes in core data.
I'm looking for this Please help me.