More detail on possible solution to problem 2:
- Add
UIStoryboardSegue+MMNavigationController.h
to your project, found in this Github repo - Import that header file in your view controller's implementation file
- Change one line in your implementation of
prepareForSegue:sender:
like so:
BookLessonViewController *destViewController = segue.topLevelDestinationViewController;
Explanation: if a storyboard segue points points to a destination view controller that is wrapped in a UINavigationController
, then the segue's destinationViewController
will value will be the navigation controller object. The code referenced here will handle this by checking whether destinationViewController
is an instance of the UINavigationController
class, and if so, will return its topViewController
instead. This is all implemented as a on the UIStoryboardSegue
class; categories are a way to add methods or properties to an existing class to extend its functionality without needing to use inheritance, etc.