If you have controllers hierarchy like
--- Navigation Controller -- | Root VC | --- tabbar controller | --- Navigation Controller -- | --- VC1
and there is a UIButton
on VC1, so on click of that you want to move to root viewcontroller (Root VC) then use :
-(void)moveToRootViewController {
//Move to root viewController
UINavigationController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"mainnav"];
self.view.window.rootViewController = controller;
}
here mainnav
is storyboard identifier of root viewcontroller Navigation Controller.

According to picture white colour viewcontroller is a root viewcontroller and tabBarController have 2 tabs with navigation controller and if you want to move to root viewcontroller from second tab viewcontroller UIButton
(black colour) click then use the above code.
If you have hierarchy like
--- Navigation Controller -- | Root VC | --- VC1---- |--- VC2---- |
and want to move to root viewcontroller (Root VC) from VC1 or from VC2 then use :
[self.navigationController popToRootViewControllerAnimated:YES];