Mad Burea Mad Burea - 1 month ago 24
Objective-C Question

How to reload content of SlideNavigationController

Actually i have created slide navigation by using this Slide Navigationcontroller

Now everything is working fine i have adjusted slide to left menu. but when i want to change it's content then at a time it does not work.

i have used this code in appdelegates for setting left menu and attached slidenavigation controller using storyboard as a root view controller of as a navigation controller

mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
employeeSlideNavigation *leftMenu = (employeeSlideNavigation*)[mainStoryboard
instantiateViewControllerWithIdentifier: @"employeeSlideNavigation"];
[SlideNavigationController sharedInstance].leftMenu = leftMenu;
[SlideNavigationController sharedInstance].menuRevealAnimationDuration = .18;


Please suggest me how to reload left menu content. actually this code is in

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

}

Answer

You can use this

Add observer with method inside the slideController class

#define NOTIFICATION_UPDATESLIDE @"UpdateSlideTable"

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDetails:) name:NOTIFICATION_UPDATESLIDE object:nil];

-(void)updateDetails:(NSNotification*)notification
{
           //content which you need to update
}

and post the notification from where you want to update the content of slide menu. like this

[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_UPDATESLIDE object:self];

Hope this helps you.