Returning to root view controller after log in
===

I'm new in so and I am pretty newbie in objective-c.Here is my situation.I have a root view controller which is a navigation controller.In my root view controller,i have horizontal tables and two bar button  which are log in and register.When i click on log in bar button,i push a view controller using navigation Controller.If log in is succeed,i want to back to root view controller but changing my bar button title to something else,what is the best way to do that ? 
Any help will be appreciated,thank u  