Hi,
I have a tabbarcontroller based app. In one tab, there is a navigationcontroller and various view controllers that get pushed onto it via storyboard segues.
I'm attempting to create a semi-transparent overlay for help instructions. The plan was to make a detached UIViewController with an UIImageView (the help text and arrows) and a button to dismiss it. This help/tutorial view would be created in the first view controller (the normal UI for the user if they do not want help overlays) which is connected to the navigation controller via a relationship segue. The tutorial view is then added as a subview.
I can get the overlay portion working and the button receives the taps well enough. It's removing the view in favor of the old view which is problematic.
Here is the code in the regular UI view controller that creates the controller for the tutorial overlay and then adds its view:
TutorialsAddItemsViewController* tv = [self.storyboard instantiateViewControllerWithIdentifier:@"tutorial"];
[self.navigationController.view addSubview:tv.view];
And here is what I have tried to do when the button gets tapped. This code is in the view controller for the overlay:
- (IBAction)dismissOverlay:(id)sender {
NSLog(@"Button tapped successfully");
[self.navigationController.view removeFromSuperview];
}
So the app blows up...
I thought of trying to get the array of subviews from self.navigationController.view and then removing the last object but that array is readonly.
I also tried storing self.navigationController.view in an ivar before adding the tutorial subview. Once added I then set the old UIView as a property of the tutorial view. Then, upon button tap, I added the old view as a subview. I didn't really think this last one would work but at that point...
Anyway, any and all help will be very much appreciated!
Thank you!