Reputation: 1712
I am following this tutorial: http://www.appcoda.com/ios-programming-sidebar-navigation-menu/
However, I need to be able to access the side menu from the classes view controller as seen in the image . While my first view controller is a login screen that the user needs to login to a a server with. To fix the problem I have made a property inside the reveal view controller
@property (strong, atomic, retain) NSString *SWSegueFrontIdentifier;
. Then I use the getters and setters to assign which view controller is should to/from. I assign the first value sw_first
in view controller and everything is fine. In ViewDidLoad of the classmates view controller, seen in the second image, i assign sw_front
. However, even when that is set in the same function, if i try to print the property from the reveal controller, it ends up returning null. However, if I manually switch the SWSegueFrontIdentifier
inside the view controller to sw_front
it segues just fine, but ends up skipping my view controller, which is my login controller. I just need a way for the side menu to be accessed from my classmates view controller and have not had any luck, because it seems most things on www.cocoacontrols.com are made to use without storyboards and I can't seem to get them to work.
This code returns null:
[self.revealViewController setSWSegueFrontIdentifier:@"sw_front"];
tempMenuButton.target = self.revealViewController;
tempMenuButton.action = @selector(revealToggle:);
NSLog(@"reveal view controller prop2: %@", self.revealViewController.SWSegueFrontIdentifier);
Any ideas on what I can do to get this to work?
EDIT: Only thing that I can think of is some sort of memory retention problem, but I can't seem to figure it out.
Upvotes: 0
Views: 172
Reputation: 148
after declaring the property @property (strong, atomic, retain) NSString *SWSegueFrontIdentifier;
ave you used a synthesize to create the getters and setters
@synthesize SWSegueFrontIdentifier = _SWSegueFrontIdentifier;
and then you just do it like this
self.revealViewController.setSWSegueFrontIdentifier =@"sw_front";
This is what I came up with.
Upvotes: 1