I'm using ECSliding and I have this problem!
I have a topView and two menus,
left (LeftViewController)
right (RightViewController)
both UIViewController
.
I want to give a reference to the right view controller, to the left view controller, in the AppDelegate.
I did in LeftViewController.h
:
#import "RightViewController.h"
@class RightViewController;
@property (strong, monatomic) RightViewController *rightView;
in didFinishLaunchingWithOptions
in AppDelegate.m
:
RightViewController *rightViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Right"];
LeftViewController *leftViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Left"];
leftViewController.rightView = rightViewController;
but I get this error in AppDelegate.m
on self.storyboard
:
Property 'storyboard not found on object of type 'AppDelegate *
How can I solve this problem?
Don't statically give them a reference to each other. Instead, when they are part of the sliding view controller self.slidingViewController
will be a valid reference and you can navigate based on the relationships that actually exist:
self.slidingViewController.underLeftViewController
When using it, you should check the class and cast the reference:
LeftViewController *leftController = self.slidingViewController.underLeftViewController;
if ([leftController isKindOfClass:[LeftViewController class]]) {
leftController. ...;
}