I am developing one iphone application in that i want to switch view controller by checking userdefaults. so i did the following:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"keyString"] != nil) {
nextViewController *redirectView = [[nextViewController alloc] initWithNibName:@"nextViewController" bundle:[NSBundle mainBundle]];
self.nextView = redirectView;
[self presentModalViewController:self.nextView animated:YES];
} else {
[defaults setObject:@"newValue" forKey:@"keyString"];
}
Its not working.. Is this the right way??? If not can anyone tell me how to do that..
Dont assign redirectView to self.nextView. Pass it directly like this