aryaxt / iOS-Slide-Menu

iOS Slide Menu with ability to add both left and right menu, and built in gesture recognizer. Similar to Path and Facebook
Other
1.53k stars 359 forks source link

Change values of text in side menu #134

Closed RehmakNatiq closed 9 years ago

RehmakNatiq commented 9 years ago

I have a label at the top of menu which displays user name , At the app start i don't have user name . the user name is to be set when user is loged in, then how can i change the text after loging in . this is code i trying but no success :- UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];

        MenuViewController *leftMenu = (MenuViewController*)[mainStoryboard
                                                             instantiateViewControllerWithIdentifier: @"MenuViewController"];

leftMenu.UserName.text=@"Rehmak"; [SlideNavigationController sharedInstance].leftMenu = leftMenu;

How can i do this ?

aryaxt commented 9 years ago

After user is logged in

MenuViewController *controller = (MenuViewController *) [SlideNavigationController sharedInstance].leftMenu;
controller. UserName.text = SOME_USERNAME;

Or you could even post a notification, and observe it in the menu

RehmakNatiq commented 9 years ago

Nothing happens . Text is not changed.

aryaxt commented 9 years ago

Log the controller, and the label and see if they are nil. If not, try saving the username, and set it when the menu is about to reveal, as the result of the notification. Sometimes views don't redraw their content correctly when they are not visible.

rixjafri commented 8 years ago

Perfect ! its working for me