Reputation: 5510
I am trying to load a new UIViewController using a UIButton press method.
this is what the code looks like
- (void) getprojectButtonSelected {
[self dismissViewControllerAnimated:NO completion:nil];
currentProjectListViewController = [[CurrentProjectListViewController alloc] initWithNibName:@"CurrentProjectListViewController" bundle:nil];
UIWindow* keyWindow= [[UIApplication sharedApplication] keyWindow];
[keyWindow addSubview: currentProjectListViewController.view];
[self presentViewController:currentProjectListViewController animated:NO completion:nil];
}
I have added currentProjectListViewController in my .h file and am calling it here.. this is the line that fails also...
there is no error code only EXC_BAD_ACCESS
any help would be greatly appreciate.
Upvotes: 1
Views: 94
Reputation: 6918
I think you should take out the [self dismissViewControllerAnimated:NO completion:nil];
. There is no reason that should be there. You are supposed to use dismissViewController
when you are trying to exit a modal segue. You did not have a current segue so it crashed. Glad it works now!
Upvotes: 2