So in my app delegate I add a call add the myViewController.view to the main window:
1. [window addSubview:myViewController.view];
In myViewController I do the following code in the viewDidAppear method:
2. [self presentModalViewController: yourViewController animated: YES];
In my yourViewController class I do the following to try and go back to the main window
3. [self dismissModalViewControllerAnimated:YES];
My main windows view appears with buttons in all, but the buttons won’t react to any click or anything. It’s like there is something over them that I can’t see.
Also, the main windows button works before this process but doesn’t after the process.
Any help would be appreciated.
[self.parentController dismissModalViewControllerAnimated:YES];UIViews can draw outside of their frames, so it might look ok, but not respond if the touch is technically outside of the frame — you also have to check that all the superview’s up the hierarchy also have a large enough frame.UIImageViewor child thereof, it won’t respond to user touches becauseUIImageViewhasuserInteractionEnabledset toNOby default. You can fix this just by settingmyImageView.userInteractionEnabled = YES;Edit: Oli pointed out in the comments that
dismissModalViewControllerAnimated:should work if called on eitherself.parentControlleror simplyself, since that method is smart enough to call the parent if needed, according to the docs. The docs also make it sound like this might behave differently if you have multiple model views open at once, though, so I would still consider it cleaner code to call the method onself.parentControllerdirectly.